pub static angleMode: AngleModeInternalTypeExpand description
Sets the current mode of p5 to given mode. Default mode is RADIANS.
Examples
function draw() {
background(204);
angleMode(DEGREES); // Change the mode to DEGREES
let a = atan2(mouseY - height / 2, mouseX - width / 2);
translate(width / 2, height / 2);
push();
rotate(a);
rect(-20, -5, 40, 10); // Larger rectangle is rotating in degrees
pop();
angleMode(RADIANS); // Change the mode to RADIANS
rotate(a); // variable a stays the same
rect(-40, -5, 20, 10); // Smaller rectangle is rotating in radians
}Parameters
mode either RADIANS or DEGREES