Canvas Play 07: Sine Wave

This demo doesn’t add much from the last demo, but demonstrates another use of the SineOscillator. It shows 120 Orbs oscillating up and down in a sine wave formation, click the image below to see it in action.

Canvas_07 Demo
[Please note that this demo hasn't been optimised to work on all machines, so you may experience some slow down]

View Source

Below, I’ve included the source code of the demo. You can have a look through all of the code properly on GitHub, but I’ll give a quick overview.

As mentioned previously, the SineOscillator uses the Sine wave to oscillate the specified property between two values. This demo lays the orbs out evenly across the x axis and applies the SineOscillator behaviour to oscillate the y value from the top to the bottom of the canvas.

You can grab the source code from GitHub and have a play.

Posted by Mark on March 22nd, 2011
 

1 Response to “Canvas Play 07: Sine Wave”

Leave a Reply