+ 4

# Html5 canvas

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

8 Answers

+ 8

Rotation calculations work better around a fixed rotation "Origin"
https://code.sololearn.com/WicmfI9tWAY9/?ref=app

+ 6

Infinite ok

+ 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

+ 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

+ 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

+ 2

Thanks a lot Louis. I so much appreciate

+ 2

Thanks a lot Calviղ

+ 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.

Hot today

Class and instance attributes

1 Votes

How does this works?

1 Votes

Please help

1 Votes

Button after Button

0 Votes

FYP PROJECT IDEAS

0 Votes