xxxxxxxxxx
function setup() {
createCanvas(400, 400);
background(100);
angleMode(DEGREES);
colorMode(HSB, 360, 100, 100, 100);
stroke(0);
noFill();
}
function draw() {
for (let i = 0; i < 10; i++) {
fill(36 * i, 80, 100, 50);
drawShape(12 - i, 200 - 10 * i);
}
noLoop();
}
function drawShape(shapeNum, size) {
push();
translate(width / 2, height / 2);
let angleStep = 360 / shapeNum;
let angle = 0;
beginShape();
for (let i = 0; i < shapeNum; i++) {
let x = size * cos(angle);
let y = size * sin(angle);
angle = angle + angleStep;
vertex(x, y);
}
endShape(CLOSE);
pop();
}