Skip to main content
100%

Mouse follower

✓ Published0🌍 Public
TtheV1rTual
Last edited Oct 28, 2021
Created on Oct 28, 2021
Forked from HTML Starter

This example demonstrates a mouse-follower visualization: a circle that tracks the cursor’s position across an SVG canvas. The circle moves continuously as the user moves the mouse, with its center coordinates updated from the event’s `clientX` and `clientY` values. The implementation uses React’s `useState` and `useCallback` hooks to manage and update the mouse position, while the `<svg>` element’s `onMouseMove` handler triggers the state change. The rendering is done via SVG, with a single `<circle>` element whose `cx` and `cy` attributes are bound to the current position. D3 is loaded but not used for interaction or data processing.

AI-generated description

A bare minimum HTML page demonstrating use of CSS and JavaScript.

See also React Starter.

MIT Licensed

Similar vizzes