🌍 Public
Viewing a saved revision (read-only)
0204182dca054861a5d9eec255bdefad
Mouse Follower That Changes Color
A circle follows the mouse cursor across a full-screen SVG canvas, changing its fill color to a random RGB value on each click. The visualization demonstrates unidirectional data flow with a state object managed by `setState`, while D3 v7 selections and the `join` pattern handle SVG rendering. Mouse position events trigger state updates through `svg.on('mousemove')`, and color changes use `svg.on('click')` with random `rgb()` generation. The example uses d3.select and d3's data join to bind single elements.
AI-generated descriptionA circle that follows the mouse using unidirectional data flow.