Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Make something

Public visualization

Viewing a saved revision (read-only)

e916ef5dfb50491cb71177da026a4401

Make something

0 stars0🌍 Public
QQingyang Wang Profolio
Last edited Feb 6, 2023
Created on Jan 14, 2023
Forked from Mouse Follower

This example demonstrates a simple interactive visualization where a circle follows the mouse cursor across the screen, using a unidirectional data flow pattern. The code uses d3-selection’s `select` and `selectAll` with data joins to create and update an SVG element. Mouse movement events trigger a `setState` function that updates an immutable state object with the cursor’s `x` and `y` coordinates, which then re-renders the circle’s `cx` and `cy` attributes. The rendered circle has a fixed radius of 50 pixels, and the SVG fills the entire viewport.

AI-generated description

A circle that follows the mouse using unidirectional data flow.