Skip to main content
100%

Mouse Follower

✓ Published1🌍 Public
PPaul B
Last edited Aug 18, 2021
Created on Aug 18, 2021

A circle follows the mouse cursor across a full-screen SVG canvas, updating its position in real time as the pointer moves. The React app uses the `useState` hook to store the current mouse coordinates and the `useCallback` hook to define a `handleMouseMove` event handler, which reads `clientX` and `clientY` from the synthetic event. The circle, with a fixed radius of 30 pixels, is rendered via SVG’s `<circle>` element, whose `cx` and `cy` attributes are bound to the state, and the window’s dimensions determine the viewport size.

AI-generated description

A program that follows your mouse with a circle

MIT Licensed

Similar vizzes