Jump to content
Search Community

Knowing when a timeline ends

PG1 test
Moderator Tag

Recommended Posts

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

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

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

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...