Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

1cb5c5842ee44ad283818023e23891d3

Mouse Follower

0 stars1🌍 Public
Ddjfeld01
Last edited Apr 3, 2021
Created on Feb 27, 2021

This example shows a yellow circle that follows the mouse cursor across the full browser window. It uses React's `useState` and `useCallback` to track mouse coordinates, which are passed to an SVG circle's `cx` and `cy` attributes. The circle has a fixed radius of 30 pixels and is rendered on an SVG canvas sized to the window's dimensions. The `onMouseMove` event handler updates the circle's position in real time, and the SVG is rendered through ReactDOM.

AI-generated description

A program that follows my mouse with a circle