Friday, December 18, 2009

Rising Bubble



Alright, first post après capstone. This is just a little experiment toying with trigonometric functions as a method of movement. Once you click somewhere in the stage, a bubble is added. A few starting values are randomly selected and then plugged into the function of a sine (sin) wave. The x coordinate of the bubble is the result of the sine wave function. A constantly increasing value is plugged into the sine function and the result is the x coordinate. Since a sine wave is a repeating, oscillating curve, we get the left to right motion. The change in the y coordinate is simply a constant increase (though that constant is randomized at the beginning of the bubble's life cycle).

Enjoy! Expect another post (maybe something a little more complex) in the next few days. If you have any suggestions or just want to see something specific, let me know. I'll see what I can do!