xxxxxxxxxx
35
const r1 = 0.25;
let a1 = 0;
// let bn;
function setup() {
createCanvas(400, 400);
// bn = createButton("save as GIF");
noStroke();
}
function draw() {
// bn.mousePressed(saveAsGIF);
scale(width, height);
background(0);
fill(255, 255, 179);
const count = 100;
let x = 0, y = 0;
for (let i = 1; i <= count; i++) {
const f = i / count;
const a = i / PI;
const d = f * r1;
x = 0.5 * (1 + cos(a * a1) * f);
y = 0.5 * (1 + sin(a * a1) * f);
const r = 0.01;
a1 += 0.0001;
if (a1 > 2 * TWO_PI) a1 = 0;
circle(x, y, r);
}
}
// function saveAsGIF() {
// saveGif("spiral.gif", 6);
// }