Share Posted August 14, 2021 Hello, 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()) myAnimation.time(previousGSDevToolsTime); 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 More sharing options...
Solution Solution Share Posted August 14, 2021 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. 1 Link to comment Share on other sites More sharing options...
Share Posted August 14, 2021 Update: I updated the trial file to honor that initial time value: https://assets.codepen.io/16327/GSDevTools3.min.js Does that work better for you? Link to comment Share on other sites More sharing options...
Author Share Posted August 15, 2021 Aaaand that's working ! 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 ^^ 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now