Jump to content
GreenSock

Leemoon

how to set reverse ease?

Recommended Posts

How to set reverse ease??

for example:

let tl = gsap.timeline({
    paused: false,
    defaults: {
        duration: 3,
        ease: "power3.in"
    }
})

tl.to(".div1", {x : 500});
tl.to(".div2", {y : 500});

tl.play();

///// when called play,  ease: "power3.in" is working.

 

tl.reverse();

////but called reverse, ease  is not working,   how to set reverse ease? please~

Link to comment
Share on other sites

Reverse just plays the animation in reverse, so it's going to have power3.out ease.

 

There's really no way to have reverse use a different ease unless the animation has played all the way through, otherwise it would jump.

  • Like 3
Link to comment
Share on other sites

Kinda sounds like a yoyoEase might work well in this case instead of reverse().  

 

let tl = gsap.timeline({
  repeat: 1,
  yoyo: true,
  defaults: {
    duration: 3,
    ease: "power3.in",
    yoyoEase: true
  }
});

Happy tweening.

:)

 

  • Like 2
Link to comment
Share on other sites

Yep, @OSUblake and @PointC are exactly right.

 

One other option: set up your animations with ease: "none" and then you can animate the playhead with any ease you want with another tween: 

 

let tl = gsap.timeline({defaults: {ease: "none"}, paused: true});
tl.to(...)
  .to(...);

// here's the magic: 
gsap.to(tl, {time: tl.duration(), ease: "power3.out"});

// then to go backwards with another ease:
gsap.to(tl, {time: 0, ease: "power4.inOut", overwrite: true});

 

  • Like 5
Link to comment
Share on other sites

Oooh, that's so clever.

  • Thanks 1
Link to comment
Share on other sites

thanks for all. thanks for resolving my problem! 

21 hours ago, Leemoon said:

 

 

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