Skip to main content
100%

8.00 Mouse Follower

✓ Published1🌍 Public
EEric Weiss
Last edited Apr 6, 2021
Created on Apr 6, 2021

A single dark circle moves within an SVG viewport in direct response to the mouse cursor. The example demonstrates a simple React state update mechanism: the `onMouseMove` event on the `<svg>` element captures cursor coordinates, which are stored in `mousePosition` via `React.useState` and applied to the circle’s `cx` and `cy` attributes. The initial position is centered at (480, 250), and the circle’s radius is set to 10% of the viewport height. Crafted with React 17 and ReactDOM, it renders a pure SVG without external data or animation libraries.

AI-generated description
MIT Licensed

Similar vizzes