+ 4

Html5 canvas

Pls how do i make a complete rotation https://code.sololearn.com/WUMCSZCT3rgp/?ref=app

14th Jun 2020, 11:43 AM
Infinite
Infinite - avatar
8 Answers
+ 8
Rotation calculations work better around a fixed rotation "Origin" https://code.sololearn.com/WicmfI9tWAY9/?ref=app
14th Jun 2020, 12:24 PM
Louis
Louis - avatar
+ 6
11th Aug 2020, 11:46 AM
Mirielle
Mirielle - avatar
+ 4
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 https://code.sololearn.com/WV43rZdayw0Z/?ref=app
14th Jun 2020, 1:23 PM
Calviղ
Calviղ - avatar
+ 3
Thanks a lot to you all, i have been able to fix it. Thanks for your contributions, i really appreciate. https://code.sololearn.com/WUMCSZCT3rgp/?ref=app
14th Jun 2020, 1:27 PM
Infinite
Infinite - avatar
+ 3
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
11th Aug 2020, 1:52 AM
Mirielle
Mirielle - avatar
+ 2
Thanks a lot Louis. I so much appreciate
14th Jun 2020, 12:35 PM
Infinite
Infinite - avatar
+ 2
Thanks a lot Calviղ
14th Jun 2020, 1:26 PM
Infinite
Infinite - avatar
+ 2
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.
11th Aug 2020, 5:13 AM
Infinite
Infinite - avatar