xxxxxxxxxx
36
// Shapes selection
//
// Jared Donovan 2022
//
// Shows how to randomly choose to draw one of four different shapes
//
let shapeChoice;
function setup() {
createCanvas(400, 400);
textAlign(CENTER, CENTER);
textSize(48);
}
function draw() {
background(220);
noStroke();
fill(255);
square(100, 100, 200);
stroke(0);
fill(255, 255, 0);
shapeChoice = floor(frameCount / 50) % 4;
if (shapeChoice == 0){
arc(100, 100, 400, 400, radians(0), radians(90), PIE);
} else if (shapeChoice == 1){
arc(300, 100, 400, 400, radians(90), radians(180), PIE);
} else if (shapeChoice == 2){
arc(300, 300, 400, 400, radians(180), radians(270), PIE);
} else if (shapeChoice == 3){
arc(100, 300, 400, 400, radians(270), radians(0), PIE);
}
text(shapeChoice, width / 2, height / 2);
}