Skip to main content
100%

Mouse Follower

✓ Published1🌍 Public
SSubhendu Karmakar
Last edited Mar 11, 2024
Created on Mar 11, 2024
Forked from Circles with D3

This example demonstrates a single semi-transparent circle that follows the mouse cursor across a light green background, changing color randomly with each click. The visualization uses D3’s `mousemove` event and `d3.pointer` to update the circle’s position, while a `click` event triggers a random hex color assignment. The circle’s coordinates and fill are stored in a state object, and D3’s data join (`selectAll`/`join`) binds this state to the SVG circle element. The rendering approach relies on direct SVG manipulation via D3, with no external data source—purely interactive and state-driven.

AI-generated description

D3 Mouse Follower

MIT Licensed

Similar vizzes