Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse follower

Public visualization

Viewing a saved revision (read-only)

8155ac1ec4704523bdcabef3414e11ad

Mouse follower

0 stars1🌍 Public
Ssheetbag
Last edited Aug 27, 2021
Created on Aug 20, 2021

A React-controlled SVG circle follows the user's mouse position across a 960×500 canvas, updating its coordinates on every `mousemove` event via the `useState` and `useCallback` hooks. The code imports `arc` from D3 v5 but does not use it, relying instead on React's synthetic event handling and direct SVG attribute updates. The circle’s center is bound to `mousePosition`, with an initial default at the canvas midpoint, and the page hides browser scrolling for a focused interactive demonstration.

AI-generated description

Mouse follower