greensock / GSAP

GSAP (GreenSock Animation Platform), a JavaScript animation library for the modern web
https://gsap.com
19.56k stars 1.72k forks source link

TweenLite.delayedCall is not called in WKWebView on locked iPad #315

Closed anivaros closed 4 years ago

anivaros commented 4 years ago

Hello! Found strange issue: I have iOS app with WKWebView control. If device is locked, function TweenLite.delayedCall called only after device unlock and app becoming active. Just setTimeout func works fine.

Can it be fixed and what difference between delayedCall and setTimeout?

Thank you!

ZachSaucier commented 4 years ago

Hey anivaros,

Jack can correct me if I'm wrong here, but I believe that GSAP by default only runs when the window has focus. You can disable this functionality by using

 TweenLite.ticker.useRAF(false);
 TweenLite.lagSmoothing(0);

For more info, see this thread.

jackdoyle commented 4 years ago

Yes, @ZachSaucier is exactly right. Browsers throttle down their requestAnimationFrame() calls to about 2fps when the tab is inactive/hidden. They typically do the same thing for setTimeout() calls as well. GSAP automatically applies lagSmoothing to help ensure that you don't have a big jump after a lag, but of course you can disable that if you prefer.