Question

Is there anyway how can we have animation callback in EaselJs framework? Basically I want to get notified for every animation sequence ends.

Was it helpful?

Solution

For a sprite sheet animation you can use onAnimationEnd like this:

// 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 

If you are using tweens from TweenJS you can use the call function on a tween instance:

Example:

Tween.get(bar, {override:true}).to({x:695}, 1500, easeType).call(tweenComplete);

Online api doc here: http://www.createjs.com/Docs/TweenJS/modules/TweenJS.html

OTHER TIPS

I highly recommend Greensock for tweening instead of tweenjs as it supports better and have more features.

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top