Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

90fec21967754af79892bc8926932aa2

Mouse Follower

0 stars1🌍 Public
11godfrey
Last edited Mar 5, 2023
Created on Mar 5, 2023

A colored circle follows the cursor across an SVG canvas, updating its position in real time. The visualization demonstrates React's state management and event handling, using the `useState` and `useCallback` hooks to track mouse coordinates. The `App` component renders an SVG with a `<circle>` element, and the `handleMouseMove` callback updates the circle's `cx` and `cy` attributes via `clientX` and `clientY` events. ReactDOM renders the component into the DOM, with the circle initially centered at 960 by 500 pixels.

AI-generated description

A program that follows your mouse with a circle.