Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

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

Comments

Sign in to join the discussion.

MIT Licensed