Skip to main content
100%

Mouse Follower

✓ Published1🌍 Public
AAmine HAMOU
Last edited Aug 13, 2021
Created on Aug 13, 2021

The example shows a black circle that follows the mouse cursor across a blank SVG canvas, updating its position in real time as the pointer moves. The code uses React hooks, specifically `useState` and `useCallback`, to track the mouse coordinates and re-render the circle’s `cx` and `cy` attributes on every move event. It renders a 960×500 SVG element with a single circle of radius 30, and the mouse position is captured via the `onMouseMove` handler.

AI-generated description

A program that follows your mouse with a circle

MIT Licensed

Similar vizzes