xxxxxxxxxx
let r;
let factor = 0;
function setup() {
createCanvas(windowWidth, screen.availHeight);
r = height/2.1;
colorMode(HSB, 360, 255, 255);
strokeWeight(2);
}
function getVector(index, total) {
const angle = map(index % total, 0, total, 0, TWO_PI);
const v = p5.Vector.fromAngle(angle + PI);
v.mult(r);
return v;
}
function draw() {
background(255);
const total = 360;
factor += 0.015;
translate(width / 2, height / 2);
stroke(50);
ellipse(0, 0, 798, 798);
noFill();
for (let i = 0; i < total; i++) {
const a = getVector(i, total);
const b = getVector(i * factor, total);
stroke(i, 255, 255, 200);
line(a.x, a.y, b.x, b.y);
}
}
function mousePressed(){
save('pix.jpg');
}