Jump to content
Search Community

Force GSDevTools to start at a given timeline time

Mamorukun test
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts



in my React application, I have to kill/recreate my GSDevTools. Before killing it, I can retrieve its time position:

let previousGSDevToolsTime = myGSDevTools.vars.animation._time;

I can then set the inTime of the new created GSDevTools to that time:

let newGSDevTools = GSDevTools.create({ ..., animation: myAnimation, inTime: previousGSDevToolsTime };

But  I can't find a way to simply make it start at than position without moving the inTime scroller. This doesn't work:

newGSDevTools.vars.animation._time = previousGSDevToolsTime;

nor (called before OR after OR before and after the new GSDevTools.create())


If I don't force inTime scroller, the new GSDevTools instance restarts the animation from start. What am I doing wrong here ?

Link to comment
Share on other sites

  • Solution

Yeah, you should pretty much never access a property that has a "_" prefix like _time - those are only for internal use. You were doing it correctly with the getter/setter like myAnimation.time(newTime);


It seemed to work fine for me when I set .time() after the GSDevTools.create().

See the Pen 66fa94872e4b5266d3ee29dc81b49b4d?editors=1010 by GreenSock (@GreenSock) on CodePen


Do you have a minimal demo showing it not working? 


EDIT: after posting, I did notice it didn't work occasionally and it looked like startup tasks were still being performed, so I just delayed it by 0.1 seconds and it appears to work. 

  • Thanks 1
Link to comment
Share on other sites

Aaaand that's working ! :D Thank you so much for the setTimeout hint Jack, I wouldn't have thought about it (taking into account that the dev tools UI appears IMMEDIATELY after the create() call). The user can still see a rapid "zero to x" on the timeline (because even with a .1 s of delay, React has the time to update the screen), but it's far better than restarting the animation from start ^^

  • Like 1
Link to comment
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.
  • Create New...