Skip to main content
100%

Mouse Follower

✓ Published1🌍 Public
MMarcus
Last edited May 22, 2022
Created on May 22, 2022

A circle follows the mouse cursor across a full-window SVG canvas. Built with React, the app tracks pointer coordinates through an SVG `onMouseMove` handler, stores them in state with the `useState` hook, and updates the circle's `cx` and `cy` attributes on every move. The `useCallback` hook memoizes the event handler for efficiency, while the initial mouse position is centered on the screen. Rendering uses ReactDOM to mount the component into the page.

AI-generated description

A program that follows the mouse with a circle.

MIT Licensed

Similar vizzes