xxxxxxxxxx
30
let x = [];
let y = [];
let points = 380;
let radius = 40;
let flowerRadius = 50;
let flowerAmp = 80;
let period = 10;
function setup() {
createCanvas(windowWidth, windowHeight);
angleMode(DEGREES);
}
function draw() {
background(220);
translate(width / 2, height / 2);
noFill();
beginShape();
for (let i = 0; i < points; i++) {
let angle = i / points * 360; // evenly space points
flowerRadius = flowerAmp * cos(angle * period);
x[i] = (radius + flowerRadius) * cos(angle);
y[i] = (radius + flowerRadius) * sin(angle);
vertex(x[i], y[i]);
}
endShape(CLOSE);
}