Skip to main content
100%

Mouse Follower Simple

✓ Published17🌍 Public
CCurran Kelleher
Last edited Mar 3, 2023
Created on Jan 8, 2023
Forked from D3 Starter

This example demonstrates a simple interactive visualization where a circle follows the mouse cursor across the screen. The circle is initially positioned at coordinates (50,50) and updates its position in real-time in response to mouse movements. The code uses the D3.js library (v7) to select the `#app` div, append an SVG element sized to the full window dimensions, and create a circle element with a radius of 50 pixels. The visualization listens for `mousemove` events on the SVG and uses the event's x and y coordinates to update the circle's `cx` and `cy` attributes, creating a direct and responsive tracking effect.

AI-generated description

A circle that follows the mouse.

MIT Licensed

Similar vizzes