xxxxxxxxxx
30
let totalPoints = 100;
let r;
let factor = 0;
function setup() {
createCanvas(800, 800);
r = width / 2;
}
function draw() {
background(255);
translate(width / 2, height / 2);
stroke(0);
strokeWeight(1);
noFill();
circle(0, 0, r * 2);
factor += 0.005;
strokeWeight(1);
for (let i = 0; i < totalPoints; i++) {
const a = getVector(i);
const b = getVector(i * factor);
line(a.x, a.y, b.x, b.y);
}
}
function getVector(i) {
const angle = map(i % totalPoints, 0, totalPoints, 0, TWO_PI);
return p5.Vector.fromAngle(angle + PI).mult(r);
}