Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse follower

Public visualization

Viewing a saved revision (read-only)

2a4b2786c96e462da9332eac7e537204

Mouse follower

0 stars1🌍 Public
JJoakim Warholm
Last edited Jun 16, 2021
Created on Jun 16, 2021

A single circle follows the mouse cursor within an SVG canvas. The circle’s position is updated via React state, triggered by an `onMouseMove` handler that tracks `clientX` and `clientY` coordinates. The example uses React 16.9 with hooks (`useState`, `useCallback`) and renders the SVG element with the circle’s `cx` and `cy` attributes bound to the current mouse position. The visualization demonstrates a simple interactive pattern with minimal code, relying solely on React’s state management and SVG rendering.

AI-generated description

A program that follows your mouse with a circle.