FlipFloop FlipFloop - 4 years ago 157
Javascript Question

How can all angles in my Processing.js program be in degrees and not radians?

I am programming a game with Javascript and ProcessingJs. On Khan Academy (where I am coding it), on a PJS program, the default angleMode (variable) is "degrees". However, when I define this mode on a webpage, the angles are still in radians... does anyone know how to change all the angles to degrees mode without changing them one by one (there is a way to change an angle from radians to degrees one by one, but this will slow down the program?

here is what the program should look like (look at the menu decoration): my project still work in progress

and here is the webpage (look at the menu): webpage test

Answer Source

Short answer: you can't.

Khan Academy uses a modified version of Processing.js in which the angles are specified in degrees. The "real" Processing.js doesn't even have an angle mode setting.

You have to use the radians() and degrees() functions to translate between them. If this is really slowing down your program (and I doubt that it is), then you should consider refactoring or just storing your angles in radians so you don't have to do any translations at all.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download