Jump to content
GreenSock

Separator

Trigger the animation on each click on React

Go to solution Solved by Cassie,

Recommended Posts

Hi there,

I'm building a multistep contact form and each time i click the next button i want the flower to rotate  for 45 degrees but now it only rotates once on the first click and not on the other clicks.

And also i want it to rotate back when i click the back button.

Attached is a simplified codepen and i hope there is enough code to explain the situation.

See the Pen PoQVZNG by Separator (@Separator) on CodePen

Link to comment
Share on other sites

  • Solution

Hey there!

 

Ah this is nice and simple, what a breath of fresh air in these forums. 💚 You just need a relative value. Happy tweening!

rotate: '+=45'

  • Like 3
Link to comment
Share on other sites

Thank you Cassie :) 

Much appreciated!

However, how do i animate back (reverse) when i click the back button?

Link to comment
Share on other sites

rotate: '-=45'

 

  • Like 1
  • Haha 1
Link to comment
Share on other sites

Lol, sorry for not thinking

  • Haha 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.
×