litiengine icon indicating copy to clipboard operation
litiengine copied to clipboard

Enhance Tweening

Open nightm4re94 opened this issue 3 years ago • 3 comments

What feature / which classes are you referring to? The Tweening framework

Describe what could be enhanced.

  • [ ] Loopable Tweens
  • [ ] Start / Stop Tween Events
  • [ ] Unit Tests
  • [ ] Camera Zooming and panning using Tweens

nightm4re94 avatar Nov 08 '20 19:11 nightm4re94

I've noticed that when the frame rate is lower than max, tweens are taking longer to complete. For example, if I specify a duration of 3 seconds, my max FPS is set to 60, and the game is running at 40 fps, it's taking closer to 5 seconds to complete the tween. Not sure if that's the intended behavior for running at a lower frame rate or not. But if it is, it would be very nice to provide a callback that executes when the tween has actually completed. That way I can string tweens together and start one exactly when the one before it ends.

Hades948 avatar Dec 23 '22 20:12 Hades948

This is indeed more of an inconsistency with documentation rather than a bug. Tween durations (like most durations in the engine) are given in ticks, not milliseconds. We should adjust the Docs to be more clear about that. To chain Tweens, you could use Game.loop().perform(), by the way. (but still, callbacks are a future requirement)

nightm4re94 avatar Dec 23 '22 22:12 nightm4re94

Oh, wow. I've been using Timer.schedule. I replaced all of those calls with Game.loop().perform() and that fixed multiple problems, haha. Thank you!!

Hades948 avatar Dec 23 '22 22:12 Hades948