Search the Community
Showing results for tags 'spirte.animations'.
-
With this code: tempBrick.animations.add('idle', ['brick_' + bID + '_1.png'], 10, false, false); tempBrick.animations.add('brick_die', [ 'brick_' + bID + '_1.png', 'brick_' + bID + '_2.png', 'brick_' + bID + '_3.png', 'brick_' + bID + '_4.png' ], 10, false, false); tempBrick.animations.add('brick_popin', [ 'brick_' + bID + '_4.png', 'brick_' + bID + '_3.png', 'brick_' + bID + '_2.png', 'brick_' + bID + '_1.png' ], 10, false, false);And then later I want to play and add custom callback when animation is played: I saw that there is: onComplete() and also a onAnimationComplete event but for that I need the animation instance... So what i thought is to get the instance from the sprite.animations ... something like sprite.animations.get("brick_die"); But the animationMnager doesn't have such a thing... there is a /*** @property {object} _anims - An internal object that stores all of the Animation instances.* @private*/ this._anims = {}; But I don't think it's supposed to be used... Also I could make a instance once I'm adding them to the sprite.animation like: var IdleBrickAnimation = tempBrick.animations.add('idle', ['brick_' + bID + '_1.png'], 10, false, false); and then: IdleBrickAnimation.onComplete(myCallBack); But since I do it in the different places and methods I expected that there is a way to get a animation by name and then play it and add a callback specifically for this play.
- 3 replies
-
- AnimationManager
- spirte.animations
-
(and 2 more)
Tagged with: