Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

092fdebae6114f0d93bb76810199a3ab

Mouse Follower

0 stars1🌍 Public
Jjulesgentry
Last edited Jul 29, 2022
Created on Jul 29, 2022

A yellow circle follows the mouse cursor inside an SVG canvas, updating its position in real time to mirror the pointer’s coordinates. The example demonstrates React’s `useState` and `useCallback` hooks to manage the cursor’s x and y values, while the `onMouseMove` event on the SVG element triggers the state update. Rendered using React DOM with D3 v5, the circle’s radius is fixed at 30 pixels, and its center is bound to the tracked mouse position.

AI-generated description

A program that follows your mouse with a circle