Angle-based functions broken when using angleMode(DEGREES)
Closed this issue · 1 comments
kyeah commented
Hello! I was attempting to use one of the angle-based functions, like ease.backInOut, and realized the values are incorrect when the sketch has the angleMode set to DEGREES.
Our workaround for now has been to set angleMode(RADIANS)
before calling p5.func functions:
angleMode(RADIANS)
let val = ease.backInOut(t)
angleMode(DEGREES)
But this was a tricky issue to debug.
Possible Resolution
Ideally the library would probably use the core JS functions, Math.sin
and Math.cos
, directly instead of the p5 equivalents, which are dependent on the user-defined angleMode.
Doesn't seem like there's any other easy way to work around this issue, since:
- I don't see an easy way to get the current angleMode in p5
degrees()
andradians()
both run conversions regardless of the angleMode
Thanks!
rev3rend commented
oh wow. did a new version of p5 change their default angleMode()? happy to flip all the cos()/sin() calls to use the core math library. that's an easy fix.