Jump to content

Estimating duration of AnimatedSprite's single run


jay3sh
 Share

Recommended Posts

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?

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Guest
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.

Loading...
 Share

  • Recently Browsing   0 members

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