Published
Edited
Apr 25, 2020
1 fork
11 stars
Insert cell
Insert cell
Insert cell
Insert cell
seed = Date.now()
Insert cell
noiseScale = 250
Insert cell
colorScale = scales.procScale([0.22, 0.55, 0.5], [0.36, 0.45, 0.41], [0.04, 0.73, 0.82], [0.46, 0.81, 0.24])
Insert cell
svg`<svg width="${w}" height="${h}">
<rect x="0" y="0" width="${w}" height="${h}" stroke="none" fill="black"></rect>

<g>
${(() => {
const points = new PoissonDiskSampling({
shape: [w, h],
minDistance: 5,
maxDistance: 15,
tries: 10
}).fill()

return points.map((d, i) => {
const pos = PVector(...d)
const noise = simplex.noise3D(pos.x/noiseScale, pos.y/noiseScale, seed)
return `<circle
cx="${pos.x}"
cy="${pos.y}"
r="${noise * 50 + 30}"
stroke="${colorScale(noise)}"
opacity="0.5"
fill="none"
/>`
}).join('\n')
})()}
</g>
</svg>`
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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