Javascript 如何在GameQuery中停止动画
我有一个图像动画开始使用GameQuery。现在我想停止动画。为此,我使用了以下代码Javascript 如何在GameQuery中停止动画,javascript,jquery,gamequery,Javascript,Jquery,Gamequery,我有一个图像动画开始使用GameQuery。现在我想停止动画。为此,我使用了以下代码 imgAnimation["myimage"] = new $.gameQuery.Animation({imageURL: imgPath + "test.png", numberOfFrame: 3, delta: 130, rate: 236, type: $.gameQuery.ANIMATION_HORIZONTAL | $.gameQuery.ANIMATION_CALLBACK})
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()
这两种方法都只是jQueryAPI的一部分
但是为什么停止方法不起作用呢
提前感谢。这在gameQuery的0.5.x版本中是不可能的,但是0.6刚刚发布并添加,这应该可以满足您的需要。您必须给我们一些更广泛的背景-如何设置$(“#myimage”)的动画?我用适当的代码编辑了这个问题