This PR intends to replace thesetInterval() in play with requestAnimationFrame(). Hopefully this improves mobile experience.
A few things to note:
without setInterval, our animation speed will increase. This can be constrained with the use of a setTimeout() around our requestAnimationFrame() callback, though this may take away the benefit of having requestAnimationFrame() in the first place. Perhaps we can specify this timeout for only desktop?
The file right now is a bit hacky, as recursive calls to requestAnimationFrame() produce a side effect for the timestep variable. I am in the process of cleaning this; however, the viz appears to be functioning correctly.
For those who can, please let me know if this speeds things up on mobile as I am not able to check on my device until changes go live.
This PR intends to replace the
setInterval()
in play withrequestAnimationFrame()
. Hopefully this improves mobile experience.A few things to note:
without
setInterval
, our animation speed will increase. This can be constrained with the use of asetTimeout()
around ourrequestAnimationFrame()
callback, though this may take away the benefit of havingrequestAnimationFrame()
in the first place. Perhaps we can specify this timeout for only desktop?The file right now is a bit hacky, as recursive calls to
requestAnimationFrame()
produce a side effect for the timestep variable. I am in the process of cleaning this; however, the viz appears to be functioning correctly.For those who can, please let me know if this speeds things up on mobile as I am not able to check on my device until changes go live.