Jump to content
Search Community

Convert CSS animation to GSAP

codru test
Moderator Tag

Recommended Posts

Hi @codru welcome to the forum!

 

I've tweaked your pen a bit how I would build the animation. The yoyo: true could work, but I frist like to have a working animation before I optimise the code, because what is there to optimise if there isn't working code?

 

I have four tweens for each button. First two tweens press the button and the second two release it.

 

What I could think of now, is that you build a function that creates an animation based on the button class you want to click and then you add the functions to a master timeline in the order that you want. 

 

Check out these awesome resources showing how what possibilities there are with GSAP . Hope it helps and happy tweening! 

 

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

 

 

Edit: Couldn't stop thinking about it 😅 

Quote

What I could think of now, is that you build a function that creates an animation based on the button class you want to click and then you add the functions to a master timeline in the order that you want. 

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

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