@steventoben
Posted
In regards to your animation being out of sync when switching tabs, that has to do with the browser's execution stack and the use of RequestAnimationFrame. RAF fires at 60fps but to optimize performance, if the tab is not being viewed the tick rate is throttled to around 2fps. If you want you could just keep the state of the timer and use the visibility API to check for when the tab regains focus and catch the value of the display up to the state.