bnb({
w: 540, h: 540,
numFrames: 100,
fps: 25,
record: true,
video: true,
preload: (s, g) => {
g.pg = s.createGraphics(540, 540)
g.pg.clear()
g.pg.stroke(255, 3)
for(let i = 0; i < 10e5; i ++) {
g.pg.point(s.random(540), s.random(540))
}
},
draw: (s, t, g) => {
const cosT = s.cos(t * s.TAU) * .15
const sinT = s.sin(t * s.TAU) * .15
s.background(44)
s.image(g.pg, 0, 0)
s.push()
s.stroke(220)
s.strokeWeight(4)
s.fill(0, 0)
s.beginShape()
for(let i = 0; i < 6; i ++) {
const v = PVector.fromAngle(s.TAU / 6 * i - s.PI/2).setMag(s.width/2 - 30)
s.vertex(v.x + s.width/2, v.y + s.width/2)
}
s.endShape(s.CLOSE)
s.drawingContext.clip()
s.translate(s.width/2, s.height/2)
s.rotate(-s.PI / 4)
s.translate(-s.width/2, -s.height/2)
s.noStroke()
s.fill(220)
const N = 80
for(let i = 0; i < N; i ++) {
let y = s.map(i, 0, N - 1, -100, s.height + 100)
const points = []
for(let x = -100; x <= s.width + 100; x += 2) {
const angle = simplex.noise4D(x / 800, y / 800, cosT, sinT) * s.TAU
points.push(PVector(x, y).add(PVector.fromAngle(angle).setMag(40)))
}
s.beginShape()
points.forEach(pt => s.vertex(pt.x, pt.y))
points.reverse().forEach(pt => {
pt.add(PVector.fromAngle(-s.PI/4).setMag(7))
s.vertex(pt.x, pt.y)
})
s.endShape(s.CLOSE)
}
s.pop()
}
})