bnb({
w: width,
h: width,
webgl: true,
fps: 30,
chromaticAberration: 1,
shutterAngle: 1,
numFrames: 30 * 10,
globals: {
pts: array(300)
},
setup: (sketch, globals) => {
globals.pts = globals.pts.map((d, i, arr) => ({
cos: sketch.cos((sketch.PI * 2 * i) / arr.length),
sin: sketch.sin((sketch.PI * 2 * i) / arr.length),
size: sketch.random(1, 5),
offset: sketch.random(1.6) * sketch.sin((i / arr.length) * sketch.TAU * 3)
}));
},
draw: (sketch, time, globals) => {
sketch.background(0);
sketch.stroke(255, 200);
sketch.push();
sketch.translate(sketch.width / 2, sketch.height / 2, 0);
sketch.rotateY(sketch.PI / 2);
sketch.fill(0);
sketch.circle(0, 0, 100);
sketch.pop();
sketch.push();
sketch.translate(sketch.width / 2, sketch.height / 2, 0);
globals.pts.forEach((pt) => {
sketch.strokeWeight(pt.size);
const x =
(200 + pt.offset * 10) * sketch.sin(time * pt.offset * sketch.TAU);
const y =
(200 + pt.offset * 10) * sketch.cos(time * pt.offset * sketch.TAU);
sketch.point(x, y, 0);
});
sketch.pop();
sketch.camera(-100, -100, 200, 200, 200, 0, 1, 1, 1);
}
})