xxxxxxxxxx
35
let a = 200;
function setup() {
createCanvas(400, 400);
background(255);
angleMode(DEGREES);
colorMode(HSB);
}
function draw() {
//background(220);
funkyShape (width/2,height/2,40,40);
funkyShape(200,200,250,250);
funkyShape(200,200,100,100);
a = a + 1;
}
function funkyShape(x,y,w,h){
//use translate to move it to where you want it to occur
push();
//remember where origin WAS
translate(x,y);
rotate(a);
fill(
map(mouseX, 0 ,width, 0, 360),
100,
map (mouseY, 0, height,0, 100),
40);
stroke(20,20);
beginShape();
vertex(0,100);
vertex(w,50);
vertex(w,h/2);
vertex(10,y);
endShape(CLOSE);
pop();
}