All examples By author By category About

rveciana

Circles bouncing inside an SVG path

Example for the Stackoverflow question: How can I contain D3 JS animation within a container

The balls use a modified version of the D3.js Force Layout. Parts of the code, such as the collision function are taken from Mike Bostock's example Multi-Foci Force Layout.

The example lacks of a method to avoid the leak of circles when the collision algorithm and the container object detection act together.