Jump to content

Callback when animation complete?


Recommended Posts

Looking at the signature for AnimationManager.play(name, frameRate, loop, killOnComplete), there doesn't appear to be a way to run a callback when an animation completes. Is there some other way to do this? If not, would it make sense to change this function to accept a callback (which could be sprite.kill)?




slightly unrelated, but there also doesn't appear to be a way to check if a sprite is animating except to check if it's currentFrame.index === original frame. Is that the right way to check it?

Link to comment
Share on other sites


Look at the events property of the sprite. There you find onAnimationStart, onAnimationComplete & onAnimationLoop

To check for a running animation use isFinished, isPaused, isPlaying on the animation instance itself (you get that reference to the animation when you call play)

animationReference = sprite.animations.play("name")animationReference.isPlaying


Link to comment
Share on other sites

  • 1 year later...
  • 4 months later...
  • 11 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...