xxxxxxxxxx
60
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))
);
shape();
shapeTwo();
pinwheel = pinwheel + 20;
}
function shape() {
push();
translate(width / 2, height / 2);
rotate(pinwheel);
beginShape();
vertex(0, 0);
vertex(-10, 5);
vertex(20, 50);
vertex(60, 60);
endShape(CLOSE);
pop();
}
function shapeTwo() {
translate(width / 2, height / 2);
rotate(pinwheel);
beginShape();
vertex(0, 0);
vertex(-20, 10);
vertex(40, 150);
vertex(80, 160);
endShape(CLOSE);
}
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();
}