Jump to content

Search In
  • More options...
Find results that contain...
Find results in...

How to restart animation from the last animation state?

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.



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.