Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Mouse Follower 2 - JAT

Public visualization

Viewing a saved revision (read-only)

6e5cd8bade834366991a32d55ce9e58b

Fork of Mouse Follower 2 - JAT

0 stars1🌍 Public
JJason Tiller
Last edited Mar 2, 2021
Created on Mar 1, 2021

This example shows a circle in an SVG that tracks the user’s mouse movements across a 960×500 canvas, starting from the center. Built with React hooks, it uses `useState` to store the cursor’s `clientX` and `clientY` coordinates and `useCallback` to update that state on every `onMouseMove` event. ReactDOM renders the SVG element and its circle, whose `cx` and `cy` attributes are bound to the tracked position. The circle’s constant radius is 30 pixels.

AI-generated description

A program that follows your mouse with a circle.