Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Mouse Follower

Public visualization

Mouse Follower

0 stars1🌍 Public
RRyan Murry
Last edited Jun 16, 2021
Created on Jun 16, 2021

A single SVG circle follows the mouse as it moves across the browser window, cycling through a rainbow of colors every second. Built with React hooks (useState, useCallback, useEffect), the component tracks mouse coordinates via onMouseMove and updates the circle's cx, cy, and fill attributes. The color changes through a 13-color array on a one-second interval, with a CSS transition smoothing the fill change. The example demonstrates interactive SVG rendering within a React application without additional data sources.

AI-generated description

Follow the mouse!

Comments

Sign in to join the discussion.

MIT Licensed