Jump to content

JS Animations-Can't Stop The Rotation...


Eyad Syria-lover

Recommended Posts

You're keeping track of the degrees of rotation, so you can stop the interval whenever that hits the place you want to stop at. You should start the rotation at 0 instead of 360 though to make it more obvious.

 

Sir Can You Provide Me With A Code (If You Don't Mind)?

Thanks In Advance...

Link to comment
Share on other sites

You need to understand the theory, giving you code to copy and paste would hinder your ability to learn.

 

Your code is starting degree at 360 and then adding 1 to it on every interval, so to count 270 degrees on top of that you would need to check for 360 + 270 degrees. When degree is equal to that amount, call clearInterval() to stop the animation

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
×
×
  • Create New...