Open dakom opened 6 years ago
I've just noticed this library exposes TimerSystemImpl
which allows users use their own timer for the TimerSystem
. (The TimerSystemImpl
gets passed to the TimerSystem
s constructor).
This would allow you to use requestAnimationFrame
and performance.now
.
The typescript code includes a couple timers for Seconds and Millisecond alarms.
Small question about those - can we switch to performance.now() instead of Date.now() ?
On a bigger topic - animation on the web is typically driven by the timestamp passed to
requestAnimationFrame
callbacks. I'm not sure about the exact implementation details, but calculating deltatime from that timestamp results in smoother animation than calculating it from a new performance.now() snapshot when the callback is run.Can we add a TimerSystem implementation based around requestAnimationFrame and the timestamp that gets passed to it? How does this gel with Sodium's approach to time in general?