Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars2🌍 Public
MMichael Bergerson
Last edited Dec 22, 2020
Created on Dec 21, 2020

A circle rendered as an SVG element follows the mouse cursor across the full browser window. The React component tracks pointer coordinates via the `onMouseMove` event handler, storing them in state with the `useState` hook. It re-renders the circle's `cx` and `cy` attributes to match the cursor's `clientX` and `clientY` values, using `useCallback` for the event handler. The visualization demonstrates real-time pointer tracking with minimal code, relying on React's declarative rendering to update the SVG circle's position.

AI-generated description

program that follows your mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed