xxxxxxxxxx
27
let x = []; let y = []; let angles = []; let startingAngles = [];
let r = 50; let num = 50; let t = 0; let a = 0;
let radius = [];
function setup() {
createCanvas(400, 400);
angleMode(DEGREES);
}
function draw() {
background(220);
translate(width/2, height/2);
noFill();
beginShape();
for (let i=0; i<num; i++) {
angles[i] = (i/num-1) * 180;
startingAngles[i] = 360/num*i;
radius[i] = map(r*cos(angles[i] + t), -r, r, 50, 100);
let cx = radius[i]*cos(a + startingAngles[i]);
let cy = radius[i]*sin(a + startingAngles[i]);
// line(0, 0, cx, cy);
vertex(cx, cy);
}
endShape(CLOSE);
// a += 0.1;
t += 1;
}