Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

Is it possible to disable lagSmoothing on a single timeline?

Recommended Posts

I am working on a game that has timer that is animating down, it indicates how much time player has left to make their move. Gsap is animating this timer. Issue I am currently facing is that if player goes to a different browser tab gsap seems to stop animating the timer. After some research I believe this is by design and feature responsible for this is "lagSmoothing" I was able to disable this via "gsap.ticker.lagSmoothing(0)". However this disables lag smoothing for my whole app. I was trying to look similar method on "TimelineLite" that I am using for timer animation, but wasn't able to find anything. Hence this question: Can I disable lagSmoothing for single timeline as opposed whole app?

Here is an example of how timeline lite is used in my app.

import { TimelineLite } from 'gsap'

const timeline = new TimelineLite()

this.timeline.to(this, { /* animation config*/ })


Link to post
Share on other sites

Hey @Ilja,


Have you seen this thread



"That's pretty unusual, but I suppose you could do that logic your own separately. Like you'd have to use Date.now() and when the tab becomes unhidden, do some comparisons to see how much time elapsed and set the progress() on your animation accordingly."


And you should also migrate to the new GSAP 3 syntax.


Happy tweening ...






  • Like 3
Link to post
Share on other sites

@mikel Ah, listening to document event for this and toggling lagSmoothing works and makes a lot of sense actually. Just a follow up question are defaults for lagSmoothing still lagSmoothing(500, 33) as in that question, or other values should be used to re-enable it?

Link to post
Share on other sites



I was digging through this myself this weekend, and stumbled upon this in the v3 docs


For example, if the threshold is 500 and the adjustedLag is 33 (those are the defaults) [...]


This feature is already activated by default, using a threshold of 500ms and a adjustedLag of 33ms



  • Like 3
Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.