Gamua / Starling-Framework

The Cross Platform Game Engine
http://www.starling-framework.org
Other
2.85k stars 819 forks source link

Request: add timeScale property to Juggler #866

Closed kevinfoley closed 7 years ago

kevinfoley commented 8 years ago

This is based on the Time.timeScale property in Unity: Add a timeScale propery to the Juggler; when the Juggler calls "advanceTime" on an IAnimatable, the "time" argument passed to advanceTime() is multiplied by the timeScale. This way you can easily speed up, slow down, or even freeze animations that utilize the time argument.

PrimaryFeather commented 8 years ago

I'm not opposed to this, might be a good idea! What do others say? Please chime in!

BTW, just for reference: my recommendation is to create your own jugglers in real apps, so that you can split all time-based logic depending on their components (e.g. menu, gui-overlay, etc). In that case, scaling the time is easy: you can call juggler.advanceTime() with the appropriate scale factor. But of course, that doesn't work with the (static) default juggler.

serjek commented 8 years ago

Sounds like a cool feature to me! Currently I'm using a getter for time that actually does the same thing - returns scaled time depending on various things, but having this feature built in would be nice.

PrimaryFeather commented 7 years ago

Done! Please let me know if that's how you wanted it. :smile:

kevinfoley commented 7 years ago

Looks great, thanks!