Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
TtrwMK
Last edited Oct 10, 2022
Created on Oct 10, 2022
Forked from Mouse Follower

This example shows a circle that continuously follows the mouse cursor across a full-window SVG canvas. Built with React, it tracks the cursor’s `clientX` and `clientY` coordinates through an `onMouseMove` event handler, storing the position in state via `useState` and updating the circle’s `cx` and `cy` attributes accordingly. The `useCallback` hook optimizes the event handler, and the component renders a single SVG `<circle>` element without any data source.

AI-generated description

A Program that follows your mouse with a circle

Comments

Sign in to join the discussion.

MIT Licensed