November 2011
Intermediate to advanced
348 pages
7h 2m
English
Now that we have a handle on the basics of animation, let's try something a little bit more complex by accelerating a box downwards due to the force of gravity.

Follow these steps to draw a box at the top of the canvas which falls downward due to the force of gravity:
Animation class:<head>
<script src="animation.js">
</script>Animation object and get the canvas context: <script>
window.onload = function(){
var anim = new Animation("myCanvas");
var canvas = anim.getCanvas();
var context = anim.getContext();box object that contains the box's position, x and ...Read now
Unlock full access