Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars0🌍 Public
Ttrissentety
Last edited Feb 3, 2023
Created on Feb 3, 2023

A circle follows the mouse cursor inside an SVG canvas, updating its position in real time as the pointer moves. The example combines React state management with D3.js v7 for SVG rendering, using the `useState` hook to track mouse coordinates and a `useCallback` event handler to update them on `mousemove`. The circle is drawn with hardcoded width and height values, and the mouse position is captured via `clientX` and `clientY` from the native browser event.

AI-generated description

Program that follows your mouse with circle.

Comments

Sign in to join the discussion.

MIT Licensed