Skip to main content
100%

Mouse Follower

✓ Published1🌍 Public
Kkosakase
Last edited Jul 12, 2021
Created on Jul 12, 2021

A circle follows the mouse cursor across an SVG canvas, updating its position in real time to mirror the pointer’s movement. The visualization uses React’s `useState` and `useCallback` hooks to track cursor coordinates (`clientX`, `clientY`) and re-render the circle’s `cx` and `cy` attributes on every mouse move. The SVG element handles the `onMouseMove` event, while the circle’s radius is fixed at 30 pixels. The code imports React, ReactDOM, and D3 v5, though no D3-specific functions are invoked beyond the library’s inclusion.

AI-generated description

A program that follows your mouse with a circle.

MIT Licensed

Similar vizzes