bnb({
w, h,
numFrames: 120,
fps: 20,
record: true,
video: 'mp4',
shutterAngle: .3,
sampelsPerFrame: 6,
shaderPass: shaders.polar(.6),
setup: (s, g) => {
class Line {
constructor() {
this.A = PVector(randInt(-w * 1.2, w * .9), randInt(-h * .4, h * .5))
this.B = this.A.clone().addX(randInt(10, w))
this.weight = randInt(2, 55)
this.offsetT = random()
this.color = palette[randInt(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(500).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.rotate(-s.PI/2)
s.drawingContext.shadowBlur = 8
s.drawingContext.shadowColor = 'black'
s.drawingContext.shadowOffsetX = -4
s.drawingContext.shadowOffSetY = -4
g.lines.forEach(l => l.display(s, t))
s.pop()
}
})