Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
MMarcus
Last edited May 22, 2022
Created on May 22, 2022

A circle follows the mouse cursor across a full-window SVG canvas. Built with React, the app tracks pointer coordinates through an SVG `onMouseMove` handler, stores them in state with the `useState` hook, and updates the circle's `cx` and `cy` attributes on every move. The `useCallback` hook memoizes the event handler for efficiency, while the initial mouse position is centered on the screen. Rendering uses ReactDOM to mount the component into the page.

AI-generated description

A program that follows the mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed