Skip to main content
Public

Share visualization

Loading preview…

Mouse Follower Simple

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 Simple

17
CCurran Kelleher
Last edited Mar 3, 2023
Created on Jan 8, 2023
Forked from D3 Starter

This example demonstrates a simple interactive visualization where a circle follows the mouse cursor across the screen. The circle is initially positioned at coordinates (50,50) and updates its position in real-time in response to mouse movements. The code uses the D3.js library (v7) to select the `#app` div, append an SVG element sized to the full window dimensions, and create a circle element with a radius of 50 pixels. The visualization listens for `mousemove` events on the SVG and uses the event's x and y coordinates to update the circle's `cx` and `cy` attributes, creating a direct and responsive tracking effect.

AI-generated description

A circle that follows the mouse.

Comments

Sign in to join the discussion.

MIT Licensed