Skip to main content
Public

Share visualization

Loading preview…

Mouse Follower

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Mouse Follower

0
LLai Yi Ohlsen
Last edited Dec 23, 2023
Created on Dec 23, 2023

A yellow circle follows the mouse cursor across a full-screen SVG canvas, using React state to track and render its position. The app listens for `mousemove` events on the SVG element, extracting `clientX` and `clientY` coordinates via `useCallback` and updating the circle’s `cx` and `cy` attributes through `useState` and `ReactDOM.render`. This demonstrates a simple interactive pattern with React’s declarative rendering and SVG’s coordinate system.

AI-generated description

A program that follows your mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed