Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

12f8e6e40e0b4c46bf488eead9f63543

Mouse Follower

0 stars1🌍 Public
XXinting Yao
Last edited Oct 28, 2019
Created on Aug 31, 2019

This example demonstrates a simple interactive visualization where a circle follows the mouse cursor within an SVG canvas. It shows how React state can track pointer position and update visual elements in real-time. The code uses React’s `useState` and `useCallback` hooks to manage the mouse coordinates from the `onMouseMove` event, and renders a single circle element with dynamic `cx` and `cy` attributes. The visualization is built with React 16.9 and rendered as SVG, with the circle starting at the center of a 960×500 pixel viewport.

AI-generated description

A program that follows your mouse with a circle.