Jump to content
Search Community

Help understand onComplete?

Eugene Rayner test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

Hello there,

 

Im trying to make some cool animations but I don't understand why 'onComplete' isn't working.

If you click on the header text, it should first fade out the header, and then scroll, and then continue with the animation.. but it doesn't do that.

I have it at the end of my Timeline so it should be firing at the end.. or is that not how it works?

 

Thanks :)

 

See the Pen WXbqWN by erayner (@erayner) on CodePen

Link to comment
Share on other sites

Are you talking about this line of code?

tl.to('.header', 3, { opacity: 0, onUpdate: moveDown() })

 

When referencing a function, don't put the parentheses at the end. That will immediately call the function.

 

So try this.

tl.to('.header', 3, { opacity: 0, onComplete: moveDown })

 

  • Like 5
  • Thanks 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...