Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...
Kenno Samulde

Adding timeScale to .reverse only

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

Hello Zach! That really solved my problem! Thank you so much, I'm a newbie in web world, guess I need more practice on actual js before jumping into this. Again thank you so much!   ?

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