Skip to main content
100%

Mouse Follower

✓ Published0🌍 Public
LLai Yi Ohlsen
Last edited Dec 23, 2023
Created on Dec 23, 2023

A yellow circle follows the mouse cursor across a full-screen SVG canvas, using React state to track and render its position. The app listens for `mousemove` events on the SVG element, extracting `clientX` and `clientY` coordinates via `useCallback` and updating the circle’s `cx` and `cy` attributes through `useState` and `ReactDOM.render`. This demonstrates a simple interactive pattern with React’s declarative rendering and SVG’s coordinate system.

AI-generated description

A program that follows your mouse with a circle.

MIT Licensed

Similar vizzes