Published
Edited
Oct 8, 2019
Fork of Shimmy
3 forks
36 stars
Insert cell
Insert cell
Insert cell
canvas = {
const context = DOM.context2d(width, height);
const coordinates = new Float64Array(points.length * 2);
const voronoi = new d3.Delaunay(coordinates).voronoi([0, 0, width, height]);
while (true) {
const z = performance.now() * 0.0001;
context.clearRect(0, 0, width, height);
for (let i = 0, j = -1; i < points.length; ++i) {
const [x, y] = points[i];
const t = noise(x * config.f, y * config.f, z) * Math.PI;
coordinates[++j] = x + config.l * Math.cos(t);
coordinates[++j] = y + config.l * Math.sin(t);
}
context.beginPath();
voronoi.update().render(context);
context.stroke();
yield context.canvas;
}
}
Insert cell
height = 600
Insert cell
points = d3.hexbin()
.radius(config.s)
.extent([[-config.l, -config.l], [width + config.l, height + config.l]])
.centers()
Insert cell
noise = {
const simplex = new (await require("simplex-noise@2"));
return simplex.noise3D.bind(simplex);
}
Insert cell
d3 = require("d3-hexbin@0.2", "d3-delaunay@5")
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