Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
RRaphael Fogha
Last edited Sep 3, 2021
Created on Aug 28, 2021

A single SVG circle follows the mouse cursor across a 960 by 500 viewport, updating its position in real time. The React component uses the `useState` hook to store the cursor’s `clientX` and `clientY` coordinates and the `useCallback` hook to handle the `onMouseMove` event on the SVG element. Each mouse movement re-renders the circle’s `cx` and `cy` attributes, creating a direct, immediate visual response without animation or interpolation. The rendering relies solely on React’s declarative SVG output.

AI-generated description

A program that follow your mouse with circle

Comments

Sign in to join the discussion.

MIT Licensed