Jump to content
Search Community

Weird delay when reversing animation

Guest
Moderator Tag

Go to solution Solved by GreenSock,

Recommended Posts

Hello! Giving context: I'm coming from Framer Motion and porting a menu animation to GSAP. I'm using the same ease and duration as I used in Framer Motion, but I get this strange delay when the reversed animation is played (when you click "CLOSE" you can feel a delay before going back to "MENU"), if I would guess, it looks like the ease is reversed too, giving this strange animation. If it is the ease, what can I do to use the same ease but in the right direction?

 

(sorry for my bad English)

 

See the Pen wvZGQQP by projects-yuri (@projects-yuri) on CodePen

Link to comment
Share on other sites

Hi @Yuri Silva welcome to the forum!

 

It is indeed the ease reversing what you're seeing, but there is a neath little trick by setting ease: "none" on the tween/timeline. You can then use a .tweenTo() function to play to a specific point but then use your fancy ease on that animation. https://gsap.com/docs/v3/GSAP/Timeline/tweenTo()/

 

Also all the transform properties are easily accessible in GSAP translateY are split in y and yPercent if you want to tween percentage values, no need to convert them to strings.

 

Hope it helps and happy tweening! 

 

See the Pen poByqRB?editors=0010 by mvaneijgen (@mvaneijgen) on CodePen

Link to comment
Share on other sites

20 minutes ago, mvaneijgen said:

Hi @Yuri Silva welcome to the forum!

 

It is indeed the ease reversing what you're seeing, but there is a neath little trick by setting ease: "none" on the tween/timeline. You can then use a .tweenTo() function to play to a specific point but then use your fancy ease on that animation. https://gsap.com/docs/v3/GSAP/Timeline/tweenTo()/

 

Also all the transform properties are easily accessible in GSAP translateY are split in y and yPercent if you want to tween percentage values, no need to convert them to strings.

 

Hope it helps and happy tweening! 

 

 

 

Thank you for the answer! This fix the main problem but I noticed that now I can't spam the button (the animation kinda waits till it reaches the end), is it related to the if statement (animation progress maybe)?

Link to comment
Share on other sites

26 minutes ago, GreenSock said:

You can just use a variable to track the open/closed state: 

 

 

 

Spam-click as much as you want! ?

Wow! That's perfect! Thank you and mvaneijgen for the help! Appreciate that!

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