Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
BBen Seebeck
Last edited Nov 3, 2021
Created on Nov 3, 2021
Forked from Smiley Face Part 1

This example shows a simple interactive visualization where a gray circle follows the mouse cursor across an SVG canvas. The circle starts at the center of a 960 by 500 pixel viewport and repositions instantly whenever the pointer moves. The code uses React's `useState` and `useCallback` hooks to track mouse coordinates via the SVG `onMouseMove` event, updating the circle’s `cx` and `cy` attributes through ReactDOM rendering. It demonstrates basic state-driven SVG updates in a React application.

AI-generated description

A program that follows your mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed