🌍 Public
Viewing a saved revision (read-only)
925ce1fb7f1c4fc3b8f526392a3786f6
Changing Colors with Waves
A grid of colored circles animates in a wave-like pattern, shifting between red and blue based on their size. The canvas rendering shows 40 by 30 circles, where each circle’s horizontal position and radius oscillate with sine and cosine functions over time. The code uses the Canvas API’s `getContext('2d')`, `beginPath`, `arc`, and `fill` methods, with `requestAnimationFrame` driving the continuous animation. Colors change dynamically: circles larger than a threshold appear blue, while smaller ones turn red, creating a pulsing, color-shifting visual effect.
AI-generated descriptionA grid of moving and colored circles.
From "Mathematical Patterns" tutorial given at MIT on July 28, 2013.