Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars0🌍 Public
NNiku12352
Last edited May 7, 2023
Created on May 7, 2023

A React and SVG visualization renders a black circle that follows the mouse cursor across a 960 by 500 canvas. As the pointer moves, the circle’s fill color changes randomly to one of six predefined hex values (e.g., red, green, blue). The application tracks cursor coordinates via the `onMouseMove` event on the `<svg>` element, updating the circle’s `cx` and `cy` attributes through React state. The code uses React’s `useState` and `useCallback` hooks to manage position and color updates efficiently.

AI-generated description

A program that follows your mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed