HTML5 Canvas Oscillation Animation Tutorial

To create an oscillation animation using HTML5 Canvas, we can use the equation for a simple harmonic oscillator to set the shape's position for each frame:

x(t) = amplitude * sin(t * 2PI / period) + x0

Open in new window

Code Editor

Modified on April 9th, 2013 by Eric Rowell
comments powered by Disqus