Jump to content

get current frame of a playing animation


charlie_says
 Share

Recommended Posts

Two facts

+ currentFrame is there internal texture frame from PIXI. It should not be confused with an 'animation frame'

+ sprite.animations ist the animation manager of a sprite. This is different from the current animation so you have to dig one level deeper as the animation manager doesn't provide the current frame number yet. (the frame property is only involved during the setting operations, this is kind of a bug or at least a not expected behaviour :) )

 

Your solution is fine. Here two alternatives.

testAnimationInstance = sprite.animations.play('testAnimation')//here is he frame property you're searching for.testAnimationInstance.frame

or if you do not want so save the current animation you can access it from the animation manager.

sprite.animations.currentAnim.frame

Regards George

Link to comment
Share on other sites

  • 1 year later...

Two facts

+ currentFrame is there internal texture frame from PIXI. It should not be confused with an 'animation frame'

+ sprite.animations ist the animation manager of a sprite. This is different from the current animation so you have to dig one level deeper as the animation manager doesn't provide the current frame number yet. (the frame property is only involved during the setting operations, this is kind of a bug or at least a not expected behaviour :) )

 

Your solution is fine. Here two alternatives.

testAnimationInstance = sprite.animations.play('testAnimation')//here is he frame property you're searching for.testAnimationInstance.frame

or if you do not want so save the current animation you can access it from the animation manager.

sprite.animations.currentAnim.frame

Regards George

thanks , but not working !!! f*

Link to comment
Share on other sites

  • 2 years later...
 Share

  • Recently Browsing   0 members

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