charlie_says Posted May 16, 2014 Share Posted May 16, 2014 Is there a way to get the current frame of a playing animation? I'm currently using:sprite.animations.currentFramewhich works, but it returns an object (with the frame in), I just wondered if there was a way of getting the frame number directly? Link to comment Share on other sites More sharing options...
Chupup Games Posted May 16, 2014 Share Posted May 16, 2014 is this not justsprite.animations.frame ? Link to comment Share on other sites More sharing options...
charlie_says Posted May 17, 2014 Author Share Posted May 17, 2014 This is what I thought it would be, but it always returns the number of frames.... Link to comment Share on other sites More sharing options...
george Posted May 17, 2014 Share Posted May 17, 2014 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.frameor if you do not want so save the current animation you can access it from the animation manager.sprite.animations.currentAnim.frameRegards George charlie_says 1 Link to comment Share on other sites More sharing options...
jvinhit Posted September 22, 2015 Share Posted September 22, 2015 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.frameor if you do not want so save the current animation you can access it from the animation manager.sprite.animations.currentAnim.frameRegards Georgethanks , but not working !!! f* Link to comment Share on other sites More sharing options...
trinity420 Posted June 15, 2018 Share Posted June 15, 2018 Just use: sprite.frame === 3 // read current frame sprite.frame = 5 // set frame Worked for me! Link to comment Share on other sites More sharing options...
Recommended Posts