How to Create a JavaScript Animation / Page 3 | WebReference

How to Create a JavaScript Animation / Page 3


[prev]

How to Create a JavaScript Animation [con't]

Bounce All Around

Let's put it all together. We can make the ball go up and down, left and right, and random speeds. We can start the animation and stop it with a click. Click here to make our example ball visible at the top of the page.

Start Animation | Stop Animation

Here's the code:

Tune In Next Time...

Is it just me, or does this look a lot like Pong without the paddles? Next time we'll make some paddles and make our little animation into an interactive Web game.

About the Author

Lisha Sterling is a partner at the venture technology firm SparkThing.com

Original: May 30, 2007

Digg This Add to del.icio.us


[prev]