Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

Rotation Values are BACKWARDS in Roll 20

I was just playing with the API and the rotation of tokens.  I tried rotating 60 degrees counter-clockwise (by adding 60 to the rotation value) - and to my complete surprise it rotated clockwise by 60 degrees. There's probably nothing that can be done for it at this point except to vent...whoever wrote that code should have consulted their high-school geometry book :)  The way it works is hurting my head. [Instead of adding the angle I want, I'll just subtract it...and then display the angle to the user as 360 minus the token's rotation (normalized to 0 to 359 degrees)...just a little bit of pain]
1603173806
Oosh
Sheet Author
API Scripter
HTML, Canvas and CSS rotations are all clockwise. It would be extremely weird for Roll20 to do the opposite, wouldn't it? Considering it uses all of those?
1603193743
David M.
Pro
API Scripter
And just to stave off potential future irritation, the positive y direction is down on the map (all points being relative to the top left square/hex) :)
1603206924
keithcurtis
Forum Champion
Marketplace Creator
API Scripter
David M. said: And just to stave off potential future irritation, the positive y direction is down on the map (all points being relative to the top left square/hex) :) This is also true of HTML, CSS and PostScript. Different uses have different conventions.
Oosh said: HTML, Canvas and CSS rotations are all clockwise. It would be extremely weird for Roll20 to do the opposite, wouldn't it? Considering it uses all of those? Wow!&nbsp; I've never used rotations with those items, but you're right - they're just following the de-facto standard.&nbsp; Can't fault them for that...Instead it's time to turn my ire on those who created css :) Here's the wiki diagram showing angles as measured correctly - counter-clockwise is the increasing value. <a href="https://en.wikipedia.org/wiki/Degree_%28angle%29#/media/File:Degree-Radian_Conversion.svg" rel="nofollow">https://en.wikipedia.org/wiki/Degree_%28angle%29#/media/File:Degree-Radian_Conversion.svg</a>
1603235602
Kurt J.
Pro
API Scripter
Bruce C. said: Oosh said: HTML, Canvas and CSS rotations are all clockwise. It would be extremely weird for Roll20 to do the opposite, wouldn't it? Considering it uses all of those? Wow!&nbsp; I've never used rotations with those items, but you're right - they're just following the de-facto standard.&nbsp; Can't fault them for that...Instead it's time to turn my ire on those who created css :) Here's the wiki diagram showing angles as measured correctly - counter-clockwise is the increasing value. <a href="https://en.wikipedia.org/wiki/Degree_%28angle%29#/media/File:Degree-Radian_Conversion.svg" rel="nofollow">https://en.wikipedia.org/wiki/Degree_%28angle%29#/media/File:Degree-Radian_Conversion.svg</a> "Correctly" depends on the context. On the cartesian coordinate plane, positive rotation is toward the positive Y axis. The same is true in Canvas (and lots of computer related things dating back to the fact that a CRT television scans from upper left to the lower right, making positive Y going downwards make sense). It is just that in canvas, positive Y is down and not up.
Oosh said: HTML, Canvas and CSS rotations are all clockwise. It would be extremely weird for Roll20 to do the opposite, wouldn't it? Considering it uses all of those? Do these also use 0 degrees as straight up the screen, or to the right, or some other direction?