setup()
setup() runs once when the sketch starts. It's the perfect place to initialize your canvas size, set drawing modes, and configure global settings that won't change during animation.
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(RADIANS); // default, but set explicitly for clarity
noStroke();
}
Line by Line:
createCanvas(windowWidth, windowHeight)- Creates a canvas that fills the entire browser window, using windowWidth and windowHeight to make it responsive
angleMode(RADIANS)- Sets angle measurements to use radians (0 to TWO_PI) instead of degrees. This is the p5.js default, but explicitly setting it makes the code clearer
noStroke()- Removes the outline/border from all shapes drawn. This prevents black lines from appearing between the colored wedges