p5.disableFriendlyErrors = true
createCanvas(windowWidth, windowHeight, WEBGL)
geom = buildGeometry(() => {
let n = round(random(5, 20))
for (let i = 0; i <= n; i++) {
random(-1, 1)*width*0.05,
map(i, 0, n, height*0.4, -height*0.4) + random(-1,1)*height*0.05
rotateX(PI/2 + random(-1, 1) * PI * 0.15)
rotateZ(random(-1, 1) * PI * 0.15)
random(0.1, 0.3) * width,
random(0.01, 0.05) * width,
const scene = floor(ms / period)
if (scene !== lastScene) {
const t = (ms % period)/period
s = map(t, 0, 0.2, 0, 1, true) * map(t, 0.8, 1, 1, 0, true)
directionalLight(s*255, s*255, s*255, -0.4, 0, 1)
directionalLight(s*255, s*255, s*255, 0.4, 0, 1)
directionalLight(s*255, s*255, s*255, 0, -0.4, 1)
directionalLight(s*255, s*255, s*255, 0, 0.4, 1)
rotateY(millis() * 0.0001)