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
DDonald Bagwell
Last edited Apr 9, 2024
Created on Apr 9, 2024

This example shows a single green circle that follows the mouse pointer across an SVG canvas. Moving the mouse updates the circle’s position via `d3.pointer` and state management, while clicking changes its fill color to a random hex value. The code uses D3 v7, with `select`, `pointer`, and data joins to bind the circle’s coordinates and radius. The visualization demonstrates reactive updates through a `setState` callback, with the circle rendered at half opacity.

AI-generated description

Creating circles with D3.

Challenge

  • Fork this example
  • Modify it
  • Maybe make it Halloween themed
  • Maybe make it Christmas themed
  • Be creative

Comments

Sign in to join the discussion.

MIT Licensed