Skip to main content
100%

Mouse Follower

✓ Published0🌍 Public
Mmelissastrong89@gmail.com
Last edited Mar 15, 2025
Created on Mar 15, 2025
Forked from Mouse Follower

This example demonstrates a red, green, or blue circle that tracks the mouse pointer across an SVG canvas, changing to a random hex color on each click. It uses D3’s `select` and `pointer` methods to capture mouse coordinates and update state through immutable update patterns, spreading the previous state object and overwriting the `x`, `y`, and `color` properties. The circle’s position and fill are bound directly to the current state values via D3 joins.

AI-generated description

A program that follows the mouse around and changes its color using immutable update patterns.

Challenge

  • Use this pattern to make something else respond to mouse events
MIT Licensed

Similar vizzes