Published
Edited
Dec 25, 2018
Fork of Silk
8 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
paths = {
noise.seed(seed)
const TAU = Math.PI * 2

const PERIODX = periodx
const PERIODY = periody
const particles = []
const NUM=num
const ITER=iter
const ROTMULT = rotmul
const SCALE = scale

for (let i = 0; i < NUM; i++) {
particles.push({
x: centre,//(i/NUM * W - W/2) * 0.8,//Math.random() * W,
// y: 0,// + Math.random() * 50,
a: Math.PI * 2 * i / NUM,
})
}

const abs = x => x < 0 ? -x : x

const paths = particles.map(initial => {
let pa = []

let p = {x:initial.x, a:initial.a}
for (let i = 0; i < ITER; i++) {
const n = noise.simplex2(p.x * PERIODX, Math.sin(p.a) * PERIODY) * ROTMULT
p.x += xmul * Math.cos(n)
p.a += Math.sin(n) * xdamp

pa.push([
Math.sin(p.a + Math.PI / 2) * p.x * SCALE + offx,
Math.cos(p.a + Math.PI / 2) * p.x * SCALE + offy
])
}

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