Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

ba4ce022119e49aa82ed1cdddec7d3d0

Mouse Follower

0 stars1🌍 Public
Ee-ines
Last edited Apr 1, 2021
Created on Apr 1, 2021

A React component renders a 960-by-500 SVG containing a single circle that follows the mouse cursor across the viewport. The circle’s center coordinates are tracked via React’s `useState` hook, updated on every `mousemove` event through a `useCallback` handler that reads `clientX` and `clientY`. The SVG element listens for the mouse movement, and the circle’s `cx` and `cy` attributes are bound to the current position state. The code uses React 16.9 and `ReactDOM.render` to display the interactive graphic.

AI-generated description

A program that follows your mouse with a circle.