Skip to main content
100%

follow the mouse

✓ Published0🌍 Public
Wwl328Weiminli
Last edited Aug 23, 2021
Created on Aug 22, 2021

A single circle follows the mouse cursor across a 960 by 500 SVG canvas. The example demonstrates interactive SVG rendering in React, updating the circle's `cx` and `cy` attributes on every `MouseMove` event. It uses React’s `useState` hook to store the cursor's client coordinates and re-renders the circle accordingly. The code relies on React 17 and ReactDOM to manage the SVG element, with no D3 functions invoked beyond the imported `arc`, which is unused in the final visualization.

AI-generated description

A demonstration of SVG shapes.

MIT Licensed

Similar vizzes