PG1 Posted September 22, 2021 Share Posted September 22, 2021 Hi, Is there any event fired, of method I can call to signify a timeline has ended? I'm using a global timeline with many appended children and I need to know when it all ends (it's variable in length) so that I can conditionally render a few other bits. Feel like gsap is well set up enough to have this covered... Link to comment Share on other sites More sharing options...
PG1 Posted September 22, 2021 Author Share Posted September 22, 2021 Sorted this using the onComplete callback on the master timeline 1 Link to comment Share on other sites More sharing options...
PG1 Posted September 22, 2021 Author Share Posted September 22, 2021 So my new questions is are there any gotchas with onComplete? I just added it with a simple function call to set a state variable in react. It cause my entire animation (and the rest of the page to stop rendering... Working on a very complex component so won't be easy to strip out - but any general things to be wary of when implementing? It seems to be causing too many re-renders then react errors to stop an infinite loop Link to comment Share on other sites More sharing options...
GreenSock Posted September 22, 2021 Share Posted September 22, 2021 18 minutes ago, PG1 said: It cause my entire animation (and the rest of the page to stop rendering... Working on a very complex component so won't be easy to strip out - but any general things to be wary of when implementing? It seems to be causing too many re-renders then react errors to stop an infinite loop There's no way that by adding a simple onComplete it'd cause a bunch of issues in your React app - there must be something else going on, likely in whatever code you're calling in the onComplete. But I can confidently say that you don't need to worry about any caveats related to adding an onComplete to a timeline. It's super simple code internally. Nothing fancy at all. I wish I could offer more advice, but without seeing a minimal demo, it's virtually impossible for us to guess at what's going on there. Sorry. If you still need some help, just shoot us a minimal demo and we'd be happy to take a peek. Also, have you see the React article?: https://greensock.com/react Link to comment Share on other sites More sharing options...
PG1 Posted September 23, 2021 Author Share Posted September 23, 2021 Im removing my question - was being an idiot 1 Link to comment Share on other sites More sharing options...
Cassie Posted September 23, 2021 Share Posted September 23, 2021 No need to delete, we all get confused sometimes! 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