Skip to main content
100%

Draggable Voronoi Circles - canvas

✓ Published0🌍 Public
Aalexmacy
Last edited Jun 23, 2017
Created on Jun 23, 2017

A canvas-based visualization shows 100 particles moving with random velocities, their positions defining a Voronoi diagram whose cells are computed in real time. Each cell contains its largest possible inscribed circle, drawn with a light gray fill, while the cell boundaries and particle centers are also rendered. Users can click and drag any particle, causing its Voronoi cell to follow the pointer and the inscribed circle to update; the active cell is highlighted in red. The animation runs via d3.timer, with particles bouncing off the canvas edges and exhibiting slight random jitter.

AI-generated description

A riff on <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/d1d81455dc21e10f742f'>Voronoi Circles</a>. I updated it to d3 v4 and added the ability to drag the polygons. See the SVG version here: <a href='http://bl.ocks.org/alexmacy/6bb8cbdaa077a267a887aeceb8a064f6'>Draggable Voronoi Circles - SVG</a>

gpl-3.0 Licensed

Similar vizzes