我有一个图像动画开始使用GameQuery。现在我想停止动画。为此,我使用了以下代码。
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();但这似乎并不管用。但同时,如果我在相同的动画元素( $("#myimage") )上使用hide()方法,它就可以工作。
这两种方法都只是jQuery应用编程接口的一部分。
但是为什么stop方法不起作用呢?
提前谢谢。
发布于 2012-03-23 22:14:16
在gameQuery的0.5.x版本中,这是不可能的,但是0.6是刚刚推出的,并且添加了pauseAnimation()和resumeAnumation(),应该可以做你想要的事情。
https://stackoverflow.com/questions/7189820
复制相似问题