Voronoï playground: Voronoï transitioning thanks to weighted Voronoï
This example demonstrates smooth transitions between two Voronoï tessellations of blue and green sites, where a slider adjusts the relative weights of each group, causing one set of sites to dominate the diagram and the other to fade out. It uses weighted Voronoï diagrams via the d3-weighted-voronoi plugin, with cells computed by a custom power diagram integrated with a convex hull algorithm and clipped to a circular SVG boundary. The animation updates cell polygons and site visibility in D3 v4, rendering SVG paths with a slider that recalibrates site weights to shift the tessellation.
AI-generated descriptionThis block experiments a new way to transition from one Voronoï tesselation to another.
Usually, this is achieved by smoothly changing the locations of sites from their original locations to their final locations, while recomputing the Voronoï tessellation during displacements. Here, I use weighted Voronoï diagram (the 2D additive weighted power diagram variation) to do the job. It gives a totally new feeling: the final tesselation seems to emerge from the initial one. The cherry on the cake, this technic allows to transition between tessellations of a distinct number of sites!
This block is a continuation of the experimentations 3, 2 and 1. It uses the d3-weighted-voronoi plugin.
User interactions :
- the top left slider allows you to change the relative weights of blue sites and green sites; when blue sites overweight green sites, the voronoï tessellation only consider blue sites (and vice versa)
- you can hide/show sites
Acknowledgments to :
- <a href='https://d3js.org/'>D3.js</a> (v.4)
- <a href='https://github.com/Kcnarf/d3-weighted-voronoi'>d3-weighted-voronoi</a> plugin
- <a href='http://blockbuilder.org'>blockbuilder.org</a>
- <a href='http://bl.ocks.org/mkedwards/'>mkedwards</a>'s block: <a href='http://bl.ocks.org/mkedwards/759e719eefe36cf9c8ab'>Treemap</a>