CHAPTER 2
- use several built-in features of JavaScript, including the Math.random and Math.floor
methods - use if and switch statements
- create a canvas using an HTML element
- draw rect angles and circ les
This chapter introduced a key feature of HTML5, the canvas, as well as the notions of randomness and
interactivity. It also presented many programming features youll use in the examples in the rest of the
book. In particular, the technique of building an application in stages is useful. The next chapter will
feature the animation of a ball bouncing in a box—preparation for the real games in Chapter 4: the
ballistics simulations called cannon ball and sling shot.