Sean19 Posted December 9, 2019 Share Posted December 9, 2019 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 More sharing options...
mikel Posted December 9, 2019 Share Posted December 9, 2019 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 4 Link to comment Share on other sites More sharing options...
Sean19 Posted December 9, 2019 Author Share Posted December 9, 2019 Thank you very much. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now