layer = (color) => `<g>
${array(n).map(() => {
const v = PVector.random(PVector(0, 0), PVector(w, h))
const pts = [v.clone()]
for(let i = 0; i < trailLength; i++){
const angle = simplex.noise3D(v.x/noiseScale, v.y/noiseScale, seed) * TAU/2
const dir = PVector.fromAngle(angle)
v.add(dir.setMag(stepLength))
if(!(v.x > 0 && v.x < w && v.y > 0 && v.y < h)) break
pts.push(v.clone())
}
return pts.map((pt, i, arr) => `<circle
cx="${pt.x}"
cy="${pt.y}"
r="${(1 - i/arr.length) * strokeWeight * arr.length / trailLength}"
stroke="${color}"
fill="none"
opacity="0.2"
/>`).join('\n')
}).join('\n')}
</g>`