Skip to main content
100%

Mouse follower

✓ Published1🌍 Public
Ssheetbag
Last edited Aug 27, 2021
Created on Aug 20, 2021

A React-controlled SVG circle follows the user's mouse position across a 960×500 canvas, updating its coordinates on every `mousemove` event via the `useState` and `useCallback` hooks. The code imports `arc` from D3 v5 but does not use it, relying instead on React's synthetic event handling and direct SVG attribute updates. The circle’s center is bound to `mousePosition`, with an initial default at the canvas midpoint, and the page hides browser scrolling for a focused interactive demonstration.

AI-generated description

Mouse follower

MIT Licensed

Similar vizzes