3 ms·
It's a pretty simple page, setTimeout should work well enough. Is the interval too high?
by kamikaz1k 7y ago
It's a pretty simple page, setTimeout should work well enough. Is the interval too high?
- winrid 7y agoThe issue's not setTimeout. Even with requestAnimationFrame, you'd combine it with setTimeout to control framerate and cpu usage. The issue is the css properties manipulated, as commented by another person.
- kroltan 7y agoIt's not just about speed, it's about timing. With setInterval the alignment of the screen refresh and the code to update will quickly become out of sync and cause periods where 2 frames are the same.