Jump to content
Search Community

How to restart animation from the last animation state?

iamacatperson test
Moderator Tag

Go to solution Solved by OSUblake,

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I have some triangle SVG shapes that change color when I click a button. Currently, there are three color combo states: default, color 1, and color 2. Then two buttons button 1 (for color 1) and button 2 (for color 2).

 

However, whenever I click button 1 (this is for color 1) right after clicking button 2, the triangles always revert to the default colors first before morphing into the new colors. 

 

What I'd like to happen is for it to morph from button 2 / color 2 state (if ever I'm coming from this state). The animation transition is more consistent and smoother this way.

 

Not sure what's the issue.

 

I have attached a codepen to demo the issue.

 

Thanks. 

See the Pen OMgPeJ by aguerrero (@aguerrero) on CodePen

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