Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
Ssofia-martinovich
Last edited Mar 16, 2021
Created on Mar 16, 2021
Forked from Mouse Follower

A circle follows the mouse cursor across an SVG canvas. The example shows how React manages interactive state by tracking pointer coordinates. Using React hooks like `useState` and `useCallback`, the component updates the circle's `cx` and `cy` attributes on every `mousemove` event. The code renders a single `<circle>` element with a fixed radius of 30, initializing mouse position at (0,0) and updating it from `clientX` and `clientY` values.

AI-generated description

A program that follows your mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed