xxxxxxxxxx
59
let pinwheel = 0;
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
}
function draw() {
strokeWeight(4);
stroke(
map(mouseX, 0, width, random(0, 225), random(0, 255)),
map(mouseX, 0, width, random(0, 225), random(0, 255)),
map(mouseX, 0, width, random(0, 225), random(0, 255))
);
fill(
map(mouseX, 0, width, random(0, 225), random(0, 255)),
map(mouseX, 0, width, random(0, 225), random(0, 255)),
map(mouseX, 0, width, random(0, 225), random(0, 255))
);
shapes();
pinwheel = pinwheel + 20;
}
function shapes() {
push();
translate(width / 2, height / 2 - 100);
rotate(pinwheel);
beginShape();
vertex(0, 0);
vertex(-10, 5);
vertex(20, 50);
vertex(60, 60);
endShape(CLOSE);
pop();
push();
translate(width / 2, height / 2 + 100);
rotate(pinwheel);
beginShape();
vertex(0, 0);
vertex(-20, 10);
vertex(40, 150);
vertex(80, 160);
endShape(CLOSE);
pop();
}
function mousePressed() {
background(
map(mouseX, 0, width, random(0, 225), random(0, 255)),
map(mouseX, 0, width, random(0, 225), random(0, 255)),
map(mouseX, 0, width, random(0, 225), random(0, 255))
);
noLoop();
}
function mouseReleased() {
loop();
}