Skip to main content
Public

Share visualization

Loading preview…

Movement of circle via mouse

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

Movement of circle via mouse

1
RRedSorrel
Last edited Sep 15, 2021
Created on Sep 15, 2021

A single circle tracks the user's mouse in real time across a full-browser SVG canvas, updating its center position on every pointer movement. Built with React, the app uses the `useState` hook to store mouse coordinates and a `useCallback` event handler for `onMouseMove`. The circle's `cx` and `cy` attributes are bound to the current state, and React re-renders the SVG element accordingly. The initial circle is positioned at the viewport center, and the circle radius is fixed at 30 pixels.

AI-generated description

Moving circle with mouse; interaction

Comments

Sign in to join the discussion.

MIT Licensed