xxxxxxxxxx
let angle = 0;
let startRadius = 10;
let increment = 1;
let numPoints = 1000;
let points = [];
function setup() {
createCanvas(400, 400);
background(255);
translate(width / 2, height / 2);
for (let i = 0; i < numPoints; i++) {
let x = startRadius * cos(angle);
let y = startRadius * sin(angle);
points.push(createVector(x, y));
angle += radians(increment);
startRadius += 0.1; // 控制螺旋的扩散速度
}
noFill();
stroke(0);
beginShape();
for (let i = 0; i < points.length - 2; i++) {
let x1 = points[i].x;
let y1 = points[i].y;
let x2 = points[i + 1].x;
let y2 = points[i + 1].y;
let x3 = points[i + 2].x;
let y3 = points[i + 2].y;
bezier(x1, y1, x2, y2, x2, y2, x3, y3);
}
endShape();
}