bnb({
w, h,
numFrames: 120,
fps: 20,
record: true,
shutterAngle: .3,
sampelsPerFrame: 6,
shaderPass: shaders.radialMirrors(5, .5, 2),
setup: (s, g) => {
class Line {
constructor() {
this.A = PVector(randInt(-w * 1.2, w * .5), randInt(-h * .5, h * .5))
this.B = this.A.clone().addX(randInt(10, w * .6))
if(s.random(1) < .5) [this.A, this.B] = [this.B, this.A]
this.weight = randInt(2, 55)
this.offsetT = random()
this.color = palette[randInt(1, palette.length)]
}
display(s, t) {
const tt = ease((t + this.offsetT) % 1, 3)
const T = linearstep(tt, 0, .3)
const T2 = linearstep(tt, .3, .6)
const A = PVector.lerp(this.A, this.B, T)
const B = PVector.lerp(this.A, this.B, T2)
s.strokeWeight(this.weight)
s.strokeCap(s.SQUARE)
s.stroke(this.color)
const move = 0
s.line(A.x, A.y + move, B.x, B.y + move)
s.line(A.x - s.width, A.y + move, B.x - s.width, B.y + move)
s.line(A.x + s.width, A.y + move, B.x + s.width, B.y + move)
}
}
g.lines = array(300).map(i => new Line())
},
draw: (s, t, g) => {
s.background(palette[0])
s.push()
s.translate(s.width/2 + random(-.1, .1), s.height/2 + random(-.1, .1))
s.drawingContext.shadowBlur = 8
s.drawingContext.shadowColor = 'black'
s.drawingContext.shadowOffsetX = -4
s.drawingContext.shadowOffSetY = -4
g.lines.forEach((l, i) => {
s.push()
s.rotate(s.PI/2 * (i % 4))
l.display(s, t)
s.pop()
})
s.pop()
}
})