Simple javascript angle question:
Which direction do angles go in in javascript?
Is it:
90
180 0
270
or
270
180 0
90
or something else?
I'm aware that javascript uses radians, I used degrees for illustraion.
On a regular unit circle, the y axis points up, so the angles increase counter-clockwise:
But in an HTML document, or the canvas element, the y axis points down, so if you increase the angle t and plot points on x, y with cos(t), sin(t), the result will be clockwise:
270
180 0
90
(Live example)
As the other answers say, that's not because of how angles work in JavaScript, but because of how the coordinate space is oriented.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With