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

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more