Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Mouse Follower

Public visualization

Fork of Mouse Follower

0 stars0🌍 Public
AAdriana Rodriguez Sanabria
Last edited Oct 20, 2021
Created on Oct 20, 2021
Forked from Mouse Follower

This example shows a red circle that follows the mouse cursor inside an SVG canvas. The circle’s position is updated to the cursor’s client coordinates, with an initial position at the canvas center. The code uses React’s `useState` and `useCallback` hooks to manage and update the mouse position state, and ReactDOM renders the SVG element, which also includes a fixed red diagonal line, into the page. The SVG `onMouseMove` event handler triggers the position update.

AI-generated description

A program that follows your mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed