Jump to content
Search Community

Adding timeScale to .reverse only

Kenno Samulde 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

I have a timeline running here for my navigation. What I want to achieve is have the animation run on a normal pace but faster when reversed. I put a timeScale on the .reverse as seen on the code, but everything now runs on the timeScale(2) speed.  Please help, would really appreciate that. 

See the Pen VoaxaK by kennosamulde (@kennosamulde) on CodePen

Link to comment
Share on other sites

Hey Kenno and welcome to the forums. 

 

I think you need to a conditional check similar to this:

 

$('.sidebar__menu').on("click", function(){
  if(!tl.reversed()) {
    tl.reversed(true).timeScale(2);
  } else {
    tl.reversed(false).timeScale(1);
  }
});

 

And you can remove the t1.reverse().timeScale(2); line above.

 

It'd be helpful for me to test with some actual HTML included in your demo.

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