Skip to main content
100%

Mouse Follower

✓ Published1🌍 Public
CCaro Arriaga
Last edited Oct 7, 2022
Created on Oct 6, 2022

A React application renders an SVG circle that follows the mouse cursor across a 960x500 coordinate space, updating its position in real time. The component uses the `useState` hook to track mouse coordinates and the `useCallback` hook to handle `onMouseMove` events, reading `clientX` and `clientY` from the event object. ReactDOM mounts the component to the DOM, and the circle's `cx` and `cy` attributes are set to the updated position, with a fixed radius of 30 pixels. The circle starts centered at the initial position (480, 250).

AI-generated description

A program that follows your mouse with a circle

MIT Licensed

Similar vizzes