paths = {
noise.seed(seed)
const particles = []
const PERIOD = period
const STEP = step
for (let i = 0; i < 300; i++) {
particles.push({
x: i/frequency * W - W/2,
y: 0,
})
}
const paths = particles.map(initial => {
let pa = []
let p = {x:initial.x, y:initial.y}
for (let i = 0; i < 100; i++) {
const n = noise.perlin2(p.x * PERIOD, p.y * PERIOD) * 3*p.y
p.x += Math.sin(n) * STEP
p.y += Math.cos(n) * STEP
pa.push([p.x, p.y])
}
p.x = initial.x; p.y = initial.y
for (let i = 0; i < 100; i++) {
const n = noise.perlin2(p.x * PERIOD, p.y * PERIOD) * 3*p.y
p.x -= Math.sin(n) * STEP
p.y -= Math.cos(n) * STEP
pa.unshift([p.x, p.y])
}
return pa
})
return paths
}