JSDemos / java-universal-tween-engine

Automatically exported from code.google.com/p/java-universal-tween-engine
0 stars 0 forks source link

Tween and TweenManager are using System.currentTimeMillis() to update #2

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
That makes it impossible to pause and resume a tween.
Example:
I have some infinite animations in my game. User pauses the game and after a 
few seconds resumes it. System.currentTimeMillis() is quite different from the 
last value remembered by tweens and they go boom.

Possible solution: add update(delta) methods to Tween and TweenManager (where 
"delta" means time since last update) and use this delta to decrease 
Tween.durationMillis. If durationMillis <= 0 -> end of tween. Tween.update() (a 
variant without arguments) could stay (nobody likes it when API breaks...) and 
calculate the delta using System.currentTimeMillis() and previous value. 

Original issue reported on code.google.com by Thotep on 31 Oct 2011 at 10:52

GoogleCodeExporter commented 9 years ago
I like the idea. I'll implement a solution asap.

Original comment by aurelien.ribon on 2 Nov 2011 at 8:37

GoogleCodeExporter commented 9 years ago
Fixed. Delta times are awesome since they enable slow-motion and fast-motion 
very easily ! Thanks for the idea ;)

Original comment by aurelien.ribon on 2 Nov 2011 at 9:58