HTML and CSS Reference
In-Depth Information
Figure 6.6. Include four gaps at 2px each. You'll need to subtract 8px from the <canvas> width, leaving 400px.
Distribute the remaining width to each brick, leaving 80px for each (400px / 5 bricks = 80px).
You could place bricks by rewriting a basic shape command over and over and over. In-
stead, create a two-dimensional array as shown in the following listing to hold each brick's
row and column. To lay down the bricks, loop through the array data and place each ac-
cording to its row and column. Modify the Bricks object with the code in listing 6.5 .
Search WWH ::

Custom Search