Jump to content
Search Community

GSAP dynamic animation on click

Jean-Loïc test
Moderator Tag

Recommended Posts

On 12/11/2019 at 7:29 PM, ZachSaucier said:

Thanks for clarifying what you're wanting. There are a few ways to handle this sort of thing. One would be to call the "out" animation/timeline then in its onComplete you do the "in" animation. That way when the other button is clicked, you overwrite the onComplete with the new animation. Any other method of waiting for the "out" animation to complete and then calling the correct animation would work.

 

The selectors of this are a bit off but it shows the gist: 

 

 

@ZachSaucier hi, thanks for this new version.

The problem on this one it's that we have again animation freezes when we click fast on each button ?

 

Link to comment
Share on other sites

2 minutes ago, ZachSaucier said:

Yep. As I said, you'd have to change the selectors some. 

Ah okay, it was to help me to keep the logic to follow, I'll explore this way too, thanks ;) 

Before you sent me this other solution, I did other tests with the old version and finally it can work well if the "scale off" run fast.

Thank you for you help ! ?

 

See the Pen povbxLb by Jean-Loic (@Jean-Loic) on CodePen

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