setup()
setup() runs exactly once when the sketch starts, making it the right place to configure the canvas and any drawing settings that shouldn't change every frame, like noStroke() or angleMode().
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(RADIANS); // default, but set explicitly for clarity
noStroke();
}
Line-by-line explanation (3 lines)
createCanvas(windowWidth, windowHeight);- Creates a canvas that fills the entire browser window, using the browser's current width and height.
angleMode(RADIANS); // default, but set explicitly for clarity- Tells p5.js that angle values (like the rotation angle) are measured in radians rather than degrees. This is actually the default, but it's set explicitly here so the code's intent is clear to readers.
noStroke();- Turns off outlines on shapes, so each colored wedge blends smoothly into its neighbor without a border line.