I have one image animation started using GameQuery. Now I want to stop the animation. For that, I have used the following code.
imgAnimation["myimage"] = new $.gameQuery.Animation({imageURL: imgPath + "test.png", numberOfFrame: 3, delta: 130, rate: 236,
type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_CALLBACK});
$("#playground").playground({height: PLAYGROUND_HEIGHT, width: PLAYGROUND_WIDTH})
.addGroup("actors", {width: PLAYGROUND_WIDTH, height: PLAYGROUND_HEIGHT})
.addSprite("myimage",{animation: imgAnimation["myimage"],
posx: imgXPos, posy: 0, width: 128, height: 384, callback: callbackAnimation})
function callbackAnimation(){
$("#myimage").stop();
$("#myimage").clearQueue();
}
$.playground().startGame();
But this does not seem to be working. But at the same time, if I use the hide() method on the same animation element( $("#myimage") ), it works.
Both methods are part of the jQuery API only.
But why does the stop method not work?
Thanks in advance.
this wasn’t possible with version 0.5.x from gameQuery, but 0.6 is just out and add pauseAnimation() and resumeAnumation() that should do just what you want.