Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
SSean Lin
Last edited Jun 20, 2021
Created on Jun 20, 2021

A circle follows the mouse cursor across a full-screen SVG canvas, updating its position in real time in response to pointer movement. The React app tracks the mouse coordinates via the `onMouseMove` event handler and stores them in state with `useState`, while `useCallback` memoizes the handler for efficiency. The circle’s center is rendered at the cursor’s `clientX` and `clientY` coordinates, with a fixed radius of 30 pixels, using React and ReactDOM to manage the SVG output.

AI-generated description

A program that follows your mouse with a circle

Comments

Sign in to join the discussion.

MIT Licensed