Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
YYohR
Last edited Oct 27, 2021
Created on Oct 27, 2021

A blue circle tracks the mouse cursor across a 960 by 500 SVG canvas. The circle follows the pointer's exact coordinates, which are captured from the `clientX` and `clientY` properties of the mouse-move event. Built with React and ReactDOM, the example uses the `useState` hook to store the cursor position and the `useCallback` hook to handle the `onMouseMove` event on the SVG element. The rendered SVG outputs a single circle whose center coordinates update dynamically with each mouse movement.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed