Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Viewing a saved revision (read-only)

b0db7503bfec41a0a5145b99dd55d26b

Mouse Follower

0 stars1🌍 Public
Bbdfee
Last edited Nov 14, 2021
Created on Nov 8, 2021

A smiley face is not shown; instead, a single circle follows the mouse cursor across a 900-by-500 SVG canvas. The circle’s fill color is computed from the cursor’s x and y coordinates using three separate `d3.scaleLinear` instances, mapping positions to RGB channel values. The React app uses the `useState` hook to update the circle’s center on every mouse move, with the D3 scales applied inside the `rgbScale` helper. The example demonstrates mixing D3’s scaling functions with React’s event handling for interactive SVG graphics.

AI-generated description

Smiley face implementation with React.