Javascript CreateJS/EaselJS框架中的动画回调
在EaselJs框架中,我们如何实现动画回调?基本上,我希望在每个动画序列结束时得到通知。对于精灵工作表动画,您可以在动画结束时这样使用:Javascript CreateJS/EaselJS框架中的动画回调,javascript,html,easeljs,Javascript,Html,Easeljs,在EaselJs框架中,我们如何实现动画回调?基本上,我希望在每个动画序列结束时得到通知。对于精灵工作表动画,您可以在动画结束时这样使用: // create a BitmapAnimation instance to display and play back the sprite sheet: var bmpAnim = new BitmapAnimation(spriteSheet); // start playing the first sequence: bmpAnim.goto
// create a BitmapAnimation instance to display and play back the sprite sheet:
var bmpAnim = new BitmapAnimation(spriteSheet);
// start playing the first sequence:
bmpAnim.gotoAndPlay("walkRt");
// the callback is called each time a sequence completes:
bmpAnim.onAnimationEnd = angleChange;
Online api doc here:
http://www.createjs.com/Docs/EaselJS/BitmapAnimation.html
如果您使用TweenJS中的tween,您可以在tween实例上使用call函数:
// create a BitmapAnimation instance to display and play back the sprite sheet:
var bmpAnim = new BitmapAnimation(spriteSheet);
// start playing the first sequence:
bmpAnim.gotoAndPlay("walkRt");
// the callback is called each time a sequence completes:
bmpAnim.onAnimationEnd = angleChange;
Online api doc here:
http://www.createjs.com/Docs/EaselJS/BitmapAnimation.html
例如:
Tween.get(bar, {override:true}).to({x:695}, 1500, easeType).call(tweenComplete);
在线api文档在此:
对于精灵工作表动画,您可以像这样在动画端使用:
// create a BitmapAnimation instance to display and play back the sprite sheet:
var bmpAnim = new BitmapAnimation(spriteSheet);
// start playing the first sequence:
bmpAnim.gotoAndPlay("walkRt");
// the callback is called each time a sequence completes:
bmpAnim.onAnimationEnd = angleChange;
Online api doc here:
http://www.createjs.com/Docs/EaselJS/BitmapAnimation.html
如果您使用TweenJS中的tween,您可以在tween实例上使用call函数:
// create a BitmapAnimation instance to display and play back the sprite sheet:
var bmpAnim = new BitmapAnimation(spriteSheet);
// start playing the first sequence:
bmpAnim.gotoAndPlay("walkRt");
// the callback is called each time a sequence completes:
bmpAnim.onAnimationEnd = angleChange;
Online api doc here:
http://www.createjs.com/Docs/EaselJS/BitmapAnimation.html
例如:
Tween.get(bar, {override:true}).to({x:695}, 1500, easeType).call(tweenComplete);
在线api文档在此:
我强烈建议将Greensock用于tweening,而不是tweenjs,因为它支持更好、功能更多
我强烈建议将Greensock用于tweening,而不是tweenjs,因为它支持更好、功能更多
在EaselJS 0.7.1中,该事件称为“animationEnd”,而“BitmapAnimation”类已被弃用,取而代之的是“Sprite”。Docs:@user1417233:联机API文档链接已断开。更新了API链接。在EaselJS 0.7.1中,该事件称为“animationEnd”,并且“BitmapAnimation”类已被弃用,取而代之的是“Sprite”。Docs:@user1417233:联机API文档链接已断开。更新的API链接。