Public
Edited
Jan 1, 2023
2 forks
9 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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,//Math.random() * W,
y: 0,// + Math.random() * 50,
})
}

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
}
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more