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

1
XXinting Yao
Last edited Oct 28, 2019
Created on Aug 31, 2019

This example demonstrates a simple interactive visualization where a circle follows the mouse cursor within an SVG canvas. It shows how React state can track pointer position and update visual elements in real-time. The code uses React’s `useState` and `useCallback` hooks to manage the mouse coordinates from the `onMouseMove` event, and renders a single circle element with dynamic `cx` and `cy` attributes. The visualization is built with React 16.9 and rendered as SVG, with the circle starting at the center of a 960×500 pixel viewport.

AI-generated description

A program that follows your mouse with a circle.

Comments

Sign in to join the discussion.

MIT Licensed