🌍 Public
Viewing a saved revision (read-only)
4fea501f4fc44a77b1b5a5bb0d06d1f4
Mouse follower
This example shows a simple smiley face that follows the mouse cursor across a 960-by-500 SVG canvas. The face is drawn with a yellow linear gradient, two elliptical eyes, and a d3.arc-generated mouth, all assembled from React components. As the user moves the mouse, the React state updates the circle’s center coordinates via the `onMouseMove` handler, re-rendering the face at the new position. The code uses React’s `useState` and `useCallback` hooks, along with d3’s `arc` for the mouth path, and renders everything as SVG elements.
AI-generated descriptionA bare minimum HTML page demonstrating use of CSS and JavaScript.
See also React Starter.