render = bnb({
w, h,
numFrames: 120,
fps: 10,
record: true,
video: true,
setup: (s, g) => {
const prng = new PRNG(prngSeed)
g.center = s.createVector(prng.rand(s.width), prng.rand(s.height))
g.n = 300
g.scale = 2
g.noiseRadius = 0.3
g.nCircles = 90
g.dashes = array(100).map((d, i, arr) => array(200).map(j => j % 2 === 1 ? prng.rand(5, i - 1) : random() > i/arr.length ? prng.rand(200) : prng.rand(3, 9)))
g.offset = array(100).map(i => random(TAU * 2))
g.c = array(100).map(i => prng.rand(1, palette.length - 1))
},
draw: (s, t, g) => {
t = ease(t, 1.1)
const cosT = s.cos(t * TAU) * g.noiseRadius
const sinT = s.sin(t * TAU) * g.noiseRadius
s.drawingContext.globalAlpha = 1
s.background(palette[0])
s.drawingContext.globalAlpha = .8
s.noFill()
for(let j = 0; j < g.nCircles; j++) {
s.drawingContext.setLineDash(g.dashes[j])
s.stroke(palette[g.c[j]])
s.strokeWeight(map(j, 20, g.nCircles, 2, 8, true))
s.beginShape()
for(let i = 0; i <= g.n; i ++) {
const angle = TAU / g.n * i + g.offset[j] + t * TAU
const x = s.cos(angle)
const y = s.sin(angle)
const v = s.createVector(x, y)
const noise = simplex.noise4D(x / g.scale, y / g.scale, cosT, sinT) / 2 + .5
v.mult(20 + j * 1)
v.mult(1 + noise * s.map(j, 0, 20, 0, 2))
v.add(g.center.x, g.center.y)
s.vertex(v.x, v.y)
}
s.endShape()
}
}
})