Jump to content
Search Community

Callback function in a timeline fires before complete

zimbeta 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

Hi Greensock gurus. Been struggling with timing this animation properly. It's business data interactive and I'd like the HTML to be updated from a content object but only at certain intervals. Please see my pen.  

 

Press button "Step 2" or "Step 3."  I want the content of the HTML to update to step 2 description but not until the timeline animation has finished. Why is this onComplete function callback not waiting until the element has stopped moving to change? The idea is the animation will move off the screen or text fade out, then update, then I bring it back in. 

 

Any help or just a general idea? Thanks so much 

 

Pete

See the Pen BqdmXV by zimbeta (@zimbeta) on CodePen

Link to comment
Share on other sites

It looks like the problem is that you've got CSS transitions applied. So every time GSAP changes a property, CSS transitions say "wait! don't do that yet...I'll take 2 seconds and animate those in". So GSAP was doing exactly what you told it to do, and the onComplete was firing appropriately...but your CSS transitions were taking another 2 seconds after that. 

 

See what I mean? 

 

I'd strongly recommend avoiding CSS transitions/animations if you're going to use GSAP to animate things. :)

  • Like 4
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...