Published
Edited
May 3, 2020
5 stars
Insert cell
Insert cell
Insert cell
Insert cell
seed = Date.now()
Insert cell
noiseScale = 1000
Insert cell
hexSize = 10
Insert cell
palette = getRandomPalette()
Insert cell
Insert cell
svg`<svg width=${w} height=${h}>
<rect width="${w}" height="${h}" fill="none" stroke="blue" />

${grid.centers
.filter(pt => pt.x > 0 && pt.x < width - 2 && pt.y > 0 && pt.y < h)
.map((d, i) => `<g transform="translate(${d.x}, ${d.y}) scale(${map(simplex.noise3D(d.x / noiseScale, d.y / noiseScale, seed), -0.8, 0.9, .2, 1, true)})">
<polygon
fill="none"
stroke="black"
points="${grid.hexPoints.map(pt => `${pt.x},${pt.y}`).join(' ')}"
/>
<polygon
transform="scale(0.75)"
fill="none"
stroke="black"
points="${grid.hexPoints.map(pt => `${pt.x},${pt.y}`).join(' ')}"
/>
<polygon
transform="scale(0.5)"
fill="none"
stroke="black"
points="${grid.hexPoints.map(pt => `${pt.x},${pt.y}`).join(' ')}"
/>
</g>`).join('\n')}
</svg>`
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