In the last chapter, we looked at one of the latest CSS3 features, the transform
property, which enabled us to create animated rotations, skews, scales, and translates. In this chapter, we're going to look at one of the new additions to HTML5—the <canvas>
element.
The best way to think of the <canvas>
element is to treat it like the kind of canvas on which an artist would paint. We can draw simple lines or complex shapes using JavaScript API methods, and there is also support for images and text. The canvas is two-dimensional at this point, but may be extended to include 3D support in the future.
The <canvas>
element, first proposed and used by Apple, has been implemented by most modern browsers, and is considered one of the most stable elements from the HTML5 specification.
The best description of the <canvas>
element I've seen states, "A canvas is a rectangle in your page where you can use JavaScript to draw anything you want, from diveintohtml5...