Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Mouse Follower that Changes Color

Public visualization

Viewing a saved revision (read-only)

f7d8f3be110a4b09a419b842a910811c

Fork of Mouse Follower that Changes Color

0 stars0🌍 Public
Ggalyniayaroshenko
Last edited May 19, 2023
Created on May 19, 2023

A circle follows the mouse across an SVG canvas, changing color with each click. The visualization uses D3's `select`, `selectAll`, and `join` methods to declaratively manage the SVG circle element, tracking mouse position and color state in an external `state` object. Rendering is driven by unidirectional data flow: `setState` updates the state and triggers a re-render, which applies the new `cx`, `cy`, and `fill` attributes to the circle.

AI-generated description

A circle that follows the mouse using unidirectional data flow.