Skip to main content
100%

Canvas Swarm

✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on May 9, 2012

A swarm of 500 points drifts and bounces across a canvas, each point’s velocity and position evolving through a simple physics model with random impulses and damping. The animation runs at a target frame rate, with a live FPS counter displayed. The visualization uses D3’s `d3.range`, `d3.scale.linear`, and `d3.timer` APIs, and renders via Canvas `getContext("2d")`, drawing each point as an arc with `beginPath` and `fill`/`stroke`. The data is procedurally generated—no external dataset—and the canvas is cleared each frame with `clearRect`.

AI-generated description

Compare to SVG Swarm.

A response to Trevor Bedford's post, Comparing performance of Processing.js and D3.js.

gpl-3.0 Licensed

Similar vizzes