Squares ↔ Hexagons
✓ Published0🌍 Public
Mmbostock
Last edited Mar 4, 2019
Created on Jun 14, 2012
This example demonstrates a smooth morphing animation between two regular plane tilings: initially square cells transition into taller, non-regular hexagons. A grid of points is shifted horizontally by a changing offset each frame, and a Voronoi diagram is computed from these points using `d3.geom.voronoi`, rendering the resulting polygons as SVG paths. The offset moves point columns alternately, causing the cell shapes to transform continuously. The code uses `d3.timer` for the animation loop, with 2-pixel circles marking each generator point.
AI-generated descriptionThese aren’t regular hexagons; they’re too tall.
gpl-3.0 Licensed