Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
notalkingplz

Second Timeline Faster Than First (same settings)

Go to solution Solved by Diaco,

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

The second timeline 'close.TimelineMax()' has similar settings to the first 'open.TimelineMax', yet the second one seems to be sped up. Press the button and wait for the animation to stop before pressing again to activate the second timeline.

See the Pen YPojQw?editors=011 by anon (@anon) on CodePen

Link to comment
Share on other sites

Yup, Diaco's solution is great. Much better to just reverse an animation than worry about 2 separate animations affecting the same properties of the same element. 

 

To explain why open appeared faster than close consider the following:

 

div has an x of 0% when your page loads.

When you open you tween the x of div to -100% (traveling a distance of 100%)

 

 

when you close you tween the x of div from -100% to +100% (traveling a distance of 200%)

You are going twice the distance with close over the same amount of time (appears faster).

 

I think you meant for close to tween back to the starting x of 0% (not +100%)

  • Like 2
Link to comment
Share on other sites

Thanks for the help and explanations. I learned a lot.

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