Html5 canvas | Sololearn: Learn to code for FREE!


Html5 canvas

Pls how do i make a complete rotation

6/14/2020 11:43:10 AM


8 Answers

New Answer


Rotation calculations work better around a fixed rotation "Origin"


Infinite ok


Infinite few mistakes you made. Redeclare all the variable. Use setInterval, instead of setTimeout or requestAnimationFrame 0.1 msec interval is too fast Different rad of cos and sin Wrong radius calculation Wrong update of x and y in update function


Thanks a lot to you all, i have been able to fix it. Thanks for your contributions, i really appreciate.


A simple 2D rotation matrix could be [x, y] [ [ cos(n), sin(n) ] [ -sin(n), cos(n)] ] or without matrix. x1 = x * cos(n) - y * sin(n) y1 = x * sin(n) + y * cos(n) x = x1 y = y1 Then you can just translate [x, y] to their origin


Thanks a lot Louis. I so much appreciate


Thanks a lot Calviղ


Thanks Mirielle, I'm currently working on linear algebra. Can i send you a message request? I just want to get some guides from you.