https://editor.p5js.org/LUNAPARK1/sketches/hbIdN-6Gq
PINWHEEL PATTERN WITH LOOP
let r, g, b;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
}
function draw() {
if (stop) {
r = random(255);
g = random(255);
b = random(255);
background(0);
translate(width / 2, height / 2);
rotate(frameCount * 0.5);
for (let i = 0; i < 10; i++) {
rotate(QUARTER_PI);
stroke(r, g, b);
line(i, 0, 150, 0);
}
for (let i = 0; i < 20; i++) {
rotate(QUARTER_PI);
stroke(200-r, 200-g, 200-b);
line(i, 0, 170, 30);
}
for (let i = 0; i < 20; i++) {
rotate(QUARTER_PI + frameCount *0.6);
stroke(240 - r, 240 - g, 240 - b);
line(1, 0, 50, 0);
}
}
}
function mousePressed(){
stop = !stop;
}