I’d like to rotate an object from -180 degrees to 180 degrees via CSS3 transforms and transitions. This works fine, but I’d like to control the direction of rotation. How to determine if it will be going clockwise or counter clockwise?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
0 .. 180 is clockwise, 0 .. -180 is counterclockwise. So, positive number rotates clockwise, negative – other way around. You can also keep increasing/decreasing the number to continue rotation, the browser will remove additional 360s.
I created an example of how to rotate:
First we display rotated div. When you click on it, it will rotate. Depending on the value – negative or positive it will rotate counter-clockwise or clockwise.