fireworks-js
fireworks-js copied to clipboard
Make parameters independent of rendering speed
Several parameters (such as the decay time) are currently dependent on the rendering time. This means that the output is significantly different for a different frame rate. I.e. with 60 fps the rays decay earlier than with 30 fps (twice as fast). In fact it should take the time since the last rendering into account.
To do so, the additional 'timestamp' from the requestAnimationFrame call can be used. This must only be compared to the previous timestamp. The initial timestamp can be retrieved by using window.now