Force Dragging II
✓ Published0🌍 Public
Mmbostock
Last edited Jul 4, 2016
Created on May 11, 2016
A grid of 324 circles is rendered on a Canvas and can be dragged individually, with collision detection preventing overlap. The example combines `d3.forceSimulation` with the `d3.forceCollide` force and `d3.drag` interaction. During dragging, simulation `alphaTarget` increases to reheat the simulation, and fixed positions (`fx`, `fy`) track the pointer. The Canvas is cleared and redrawn on each tick, with circles drawn using the Canvas 2D API.
AI-generated descriptionThis example demonstrates using d3.drag with d3.forceCollide to implement draggable circles with collision detection.