Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

2be2feb6ae0f4856b27637ab01f89ac1

Mouse Follower

0 stars1🌍 Public
AAD-W99
Last edited Sep 17, 2022
Created on Sep 17, 2022

A yellow circle follows the mouse cursor across a blank SVG canvas. The example demonstrates mouse tracking in React by updating the circle’s center coordinates on every pointer move. It uses React’s `useState` and `useCallback` hooks, with the `onMouseMove` event handler reading `clientX` and `clientY` from the event object to re-render the circle. The SVG is rendered via ReactDOM, and the initial circle position is centered within a 960×500 viewport.

AI-generated description

A program that follows your mouse with a circle.