Jump to content
Search Community

Spinning Square

Sean19 test
Moderator Tag

Recommended Posts

Hello. In the codepen above, I am trying to be able to spin the square either to the left or the right depending on which button is clicked. For example: If I click the left button, I want the square to spin to the left by say 60 deg and if I click the left button again, it would spin to the left again by 60 deg, but if i click the right button I want the disc to spin to the right by 60 deg. Right now I have the square spinning to the left and right but it will not keep spinning if I continue to click. Thank you in advance for any help.  

See the Pen GRgooWY by joseph19 (@joseph19) on CodePen

Link to comment
Share on other sites

Hey @Sean19,

 

from the docs

 

Relative values
Use a "+=" or "-=" prefix to indicate a relative value. 
For example, gsap.to(".class", {x:"-=20"}); will animate x 20 pixels 
less than whatever it is when the tween starts. {x:"+=20"} would add 20.

 

Happy tweening ...

Mikel

 

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