HTML and CSS Reference
In-Depth Information
vas> tag's width and height. Also, Canvas doesn't use CSS; you must manually program
all visual output in JavaScript.
Step 5: Color the bricks
Your bricks are set up, but you need to skin them so they're visible. You'll create a cached
linear gradient (colors that change between two defined points on a Cartesian graph) with
the following listing by coloring each brick based on its row via a switch statement. Add
your new gradient and makeGradient methods to the existing Bricks object.
Listing 6.6. game.js—Coloring bricks
Search WWH ::

Custom Search