Skip to main content
100%

Mouse follower

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

A circle follows the cursor as it moves across an SVG canvas. The example uses React’s `useState` and `useCallback` hooks to track mouse coordinates from the `onMouseMove` event, updating the circle’s `cx` and `cy` attributes in real time. The SVG’s width is fixed at 960 pixels and height at 500, with the initial position centered. The rendering is done entirely through React’s declarative component structure, producing a simple interactive visualization without any external data sources.

AI-generated description

Mouse follower

MIT Licensed

Similar vizzes