jay3sh Posted November 17, 2017 Share Posted November 17, 2017 In my game I've a tower sprite (it's a top-down 2D RTS game). I rotate it with my animation mechanism (i.e. I update the sprite.rotation in steps). While rotating I also want to run the firing animation of this tower sprite. To synchronize these two animations I want to know how long (in msec) it will take for one run of the sprite animation. The only way to specify how fast the AnimatedSprite should run is to set the `speed` property. However this value is an arbitrary scaling factor for internal time. Is there a way to estimate how long a single run of the animation takes for a given `speed` value? Quote Link to comment Share on other sites More sharing options...
ivan.popelyshev Posted November 17, 2017 Share Posted November 17, 2017 Look up sources: https://github.com/pixijs/pixi.js/blob/dev/src/extras/AnimatedSprite.js Look up for problems of pixi vanilla AnimatedSprite: https://github.com/pixijs/pixi.js/issues/4270 Look up other people implementations : https://gitlab.com/griest/pixi-actor#README Also you have to know that "delta" value used in all pixi tickers is 1.0 for ideal frame of 60 FPS, that's why you can write things like "mySprite.x += 0.1 * delta". If you want fixed frames, either make sure delta passed to AnimatedSprite is always 1.0 by turning off autoUpdate and calling update(1.0) on your side. Or you can write your own AnimatedSprite. jay3sh 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.