Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Mouse Follower

Public visualization

Viewing a saved revision (read-only)

1b2fd72b6fe0468baa18971052e5110b

Fork of Mouse Follower

0 stars0🌍 Public
AAsad Zaman
Last edited May 22, 2022
Created on May 22, 2022
Forked from Mouse Follower

This example shows a circle that follows the mouse cursor across an SVG canvas. The visualization uses React with the `useState` and `useCallback` hooks to track mouse coordinates and re-render the circle's position on every `mousemove` event. The circle is rendered as an SVG element with its `cx` and `cy` attributes bound to the current mouse position, while `clientX` and `clientY` from the event provide the updated coordinates. ReactDOM manages the component mounting, and the canvas is fixed at 960 by 500 pixels.

AI-generated description

A program that follows your mouse with a circle.