Skip to main content
100%

Mouse Follower

✓ Published0🌍 Public
JJackson Gordon
Last edited Oct 11, 2021
Created on Oct 8, 2021

A React component tracks the mouse position and renders a single circle that follows the cursor across an SVG canvas. The application uses React’s `useState` and `useCallback` hooks to store and update the mouse coordinates, which are passed as `cx` and `cy` attributes to the SVG circle element. The circle starts centered on a 960 by 500 pixel viewport and moves smoothly in response to `onMouseMove` events. The example demonstrates a simple interactive pattern with React and SVG without any external data sources.

AI-generated description

circle that follows your mouse.

MIT Licensed

Similar vizzes