Thanks!
That hidden helper seems to have done the trick.
Am I wrong in thinking the below modifications also mean you get the benefits of lag smoothing when the page is visible?
function tickGSAPWhileHidden(value) {
if (value === false) {
document.removeEventListener("visibilitychange", tickGSAPWhileHidden.fn);
return clearInterval(tickGSAPWhileHidden.id);
}
const onChange = () => {
clearInterval(tickGSAPWhileHidden.id);
document.hidden && (tickGSAPWhileHidden.id = setInterval(() => {
gsap.ticker.lagSmoothing(0)
gsap.ticker.tick()
}, 100));
!document.hidden && gsap.ticker.lagSmoothing(400, 40)
};
document.addEventListener("visibilitychange", onChange);
tickGSAPWhileHidden.fn = onChange;
onChange(); // in case the document is currently hidden.
}