Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
CChira Cezara Victoria
Last edited Sep 30, 2021
Created on Sep 30, 2021

A yellow circle follows the mouse cursor across an SVG canvas, updating its position in real time with each pointer movement. The visualization uses React hooks (`useState` and `useCallback`) to manage mouse coordinates and trigger re-renders, while React’s synthetic `onMouseMove` event captures the cursor’s clientX and clientY values. Rendered as an SVG circle, the example demonstrates a simple interactive pattern leveraging D3’s presence only for the script tag, with React handling all state and rendering logic.

AI-generated description

A program that follows your mouse

Comments

Sign in to join the discussion.

MIT Licensed