Skip to main content
100%

Fork of Fork of mouse event

✓ Published0🌍 Public
LLívia Pinheiro
Last edited Aug 13, 2024
Created on Aug 13, 2024

A circle follows the mouse cursor across a 960-by-500 SVG canvas, with its center position updating in real time to match the pointer's coordinates. The visualization is built using React 18 and D3 v7, where the `useState` hook tracks the mouse position and a `useCallback` handler on the SVG element passes `clientX` and `clientY` values from the event to update the circle's `cx` and `cy` attributes. The code renders a single red circle via D3's `range` helper, though the range function is imported but unused in this example.

AI-generated description

A bare minimum HTML page.

MIT Licensed

Similar vizzes