This block shows the two ways of using the new (as of 03 oct. 2018) v2 major release of the d3-voronoi-map:
- live Voronoï map: displays the evolution of the self-organizing Voronoï map; each iteration is displayed, with some delay between iterations so that the animation is appealing to human eyes;
- static Voronoï map: displays only the final most representative Voronoï map, which is faster than the live use case; intermediate iterations are silently computed, one after each other, without any delay.
Take a look at the code of the ‘loop’ function to understand how to use this feature.
Because this block focus on demonstrating how to animate the Voronoï map from scratch, each iteration is independant from the others, meaning that each iteration computes the Voronoï map of a totally new set of weights. If you’re interested in updating an existing Voronoï map from an old set of weights to a set of new ones, take a look at the Update & Animate a Voronoï map block.
User interactions :
- you can choose to use visualize the live arrangement (default), or simply the static final arrangement.
- you can choose to draw the Weighted Voronoï Diagram (default), the weights (visualized as circles), or both.
- you can hide/show sites (hide by default)
- you can choose among different rendering (greyscale, radial rainbow, or conical rainbow (default, having hard-&-fun time to implement it because canvas don’t provides conical gradient)).
Acknowledgments to :