Jump to content

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

Change easing when reversing tween or timeline

Recommended Posts

I have a gsap timeline, which I trigger on hover and play it reversed on mouseleave.


However I need to change the easing when I play the timeline reversed. Is there a way I can do this without duplicating the whole timeline again?


Here is a stripped down example, full example is in the codepen.


const ease = 'power2.out'

const tl = gsap.timeline({ paused: true })

// tweens here...

card.addEventListener('mouseenter', (e) => {

card.addEventListener('mouseleave', (e) => {
  // need to somehow change the easing to 'power2.in' here


See the Pen abpZWOJ?editors=0010 by marco_fugaro (@marco_fugaro) on CodePen

Link to comment
Share on other sites


Hey @marco.fugaro - welcome to the forums.


I think technically exchanging the ease(s) would result in logic issues as was hinted to in this thead




What you could do though, is tween on the time of the timeline instead and use different eases there as suggested by @PointC in this thread:




With your example that could look something like this; seems to work quite right. Does that work for you?


See the Pen 05ad643619fcaf511016a2ebf761bd74 by akapowl (@akapowl) on CodePen




Please note, that I updated your GSAP version in this pen to 3.6.1 because from what I understood there were some issues with .tweenTo/.tweenFromTo in 3.6.0, as mentioned in this thread:




  • Like 2
Link to comment
Share on other sites

Hey @akapowl, thanks for the solution, didn't know about that method.

Worked out leaving `ease: 'none'` in the timeline and using the eases in `tweenFromTo` calls.

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