10.07.2017 Views

246996016-HTML5-Step-by-Step

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Using the <strong>HTML5</strong> Tag 309<br />

If you become bored with a 4 <strong>by</strong> 4 grid, change the number of blocks <strong>by</strong> changing this<br />

line in the code, as follows:<br />

var numBlocks = 4;<br />

The code in the example will dynamically change the grid to match the number of blocks<br />

you specify <strong>by</strong> setting the numBlocks variable. Although this example uses several Java-<br />

Script elements that are beyond the scope of this book, it is a good introduction to the<br />

interactivity possible with even a basic canvas application.<br />

The element will grow in popularity and usage over the next several years,<br />

but it will be quite some time before all browsers will support it. For example, even<br />

though Internet Explorer 9 will support the canvas element, the older versions of Internet<br />

Explorer will linger for years to come. However, If you’d like to learn more about the<br />

element, including seeing additional (and much more full-featured) examples<br />

and a tutorial, visit https://developer.mozilla.org/en/HTML/Canvas.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!