Jump to content
Search Community

Please help toggle Keyframe animation by clicking button!

crbopp99 test
Moderator Tag

Go to solution Solved by PointC,

Recommended Posts

Welcome to the forums, @crbopp99

 

That seems super weird to use GSAP to toggle the play state of a CSS animation. Ha. :) I'd just animate with GSAP and skip the CSS stuff. 

 

I wonder if this is what you were trying to do?: 

See the Pen 50c72fcec6b4448e01bed07b27ccbd16?editors=0010 by GreenSock (@GreenSock) on CodePen

 

I'd personally recommend animating an actual image (x and y properties - transforms) instead of backgroundImage because you'll usually get better rendering performance and browsers typically force background-position to snap to whole pixels which can make it look a bit jerky at slow speeds and small distances (totally unrelated to GSAP). It's up to you, of course. 

 

Happy tweening!

  • Like 3
Link to comment
Share on other sites

On 3/3/2021 at 10:29 PM, GreenSock said:

Welcome to the forums, @crbopp99

 

That seems super weird to use GSAP to toggle the play state of a CSS animation. Ha. :) I'd just animate with GSAP and skip the CSS stuff. 

 

I wonder if this is what you were trying to do?: 

 

 

 

I'd personally recommend animating an actual image (x and y properties - transforms) instead of backgroundImage because you'll usually get better rendering performance and browsers typically force background-position to snap to whole pixels which can make it look a bit jerky at slow speeds and small distances (totally unrelated to GSAP). It's up to you, of course. 

 

Happy tweening!

Thank you! That's exactly what I was trying to do! Now how do I make all the buttons do that animation but have it reset and then refill when I click another button? 

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