xxxxxxxxxx
28
let points = [];
const sc = 0.4;
const base = 1.0;
const speed = 1;
let gr;
function setup() {
gr = (1+sqrt(5))*180;
console.log(gr);
createCanvas(1000, 1000);
for (let ni = 0; ni < 5; ni++) {
points.push(new createVector(base * cos(ni / 5 * 2 * PI), base * sin(ni / 5 * 2 * PI)));
points.push(new createVector(sc * base * cos((ni / 5 + 1 / 10) * 2 * PI), sc * base * sin((ni / 5 + 1 / 10) * 2 * PI)));
}
background(0);
}
function draw() {
if (frameCount < 1000) {
translate(width / 2, height / 2);
rotate(frameCount*gr);
stroke(0,frameCount/10,0.0,frameCount);
line((1 + frameCount / speed) * points[points.length - 1].x, (1 + frameCount / speed) * points[points.length - 1].y, (1 + frameCount / speed) * points[0].x, (1 + frameCount / speed) * points[0].y);
for (let ni = 1; ni < points.length; ni++) {
line((1 + frameCount / speed) * points[ni].x, (1 + frameCount / speed) * points[ni].y, (1 + frameCount / speed) * points[ni - 1].x, (1 + frameCount / speed) * points[ni - 1].y);
}
}
}