CreateJS/EaselJS 框架中的动画回调

Animation callback in CreateJS/EaselJS Framework

本文关键字:动画 回调 框架 EaselJS CreateJS      更新时间:2023-09-26

无论如何,我们如何在EaselJs框架中进行动画回调?基本上,我希望在每个动画序列结束时收到通知。

我强烈推荐Greensock进行补间而不是补间,因为它支持更好并且具有更多功能。

http://www.greensock.com/v12/

对于精

灵表动画,您可以使用 onAnimationEnd 像这样:

// 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.get(bar, {override:true}).to({x:695}, 1500, easeType).call(tweenComplete);

在线 api 文档在这里:http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html