Jump to content
GreenSock

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

Time

Recommended Posts

const openMenu = gsap.timeline();
openMenu.to("#main-nav", {
    duration: .6,
    y:'100%',
    ease: Power4.easeOut,
});
openMenu.pause();

$('.open-menu').on("click", function(){
    $(this).toggleClass('active');
    if($(this).hasClass('active')){
        openMenu.play().timeScale(1);
    }
    else {
        openMenu.reverse().timeScale(2);
    }
});

Hi guys, 

I'm trying to increase the speed for the timeline reverse. When I try it like shown in my code the reverse does nothing. When I remove the timeScale for the reverse it does reverse but in the same speed as the initial playing speed. Can anyone point me in the right direction? 
Thanks in advance,

Pieter

Link to comment
Share on other sites

Hey Pieter and welcome to the GreenSock forums!

 

.timeScale() changes the direction of the animation. But actually timeScale can go negative! So you could use .timeScale(-2) here instead.

  • Like 2
Link to comment
Share on other sites

Ah, nice. Thanks! 

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