02.06.2013 Views

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

jQuery 1.4 Animation Techniques - Index of

SHOW MORE
SHOW LESS

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

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

10<br />

Canvas <strong>Animation</strong>s<br />

In the last chapter, we looked at one <strong>of</strong> the latest CSS3 styles: the transform,<br />

which enabled us to create animated rotations, skews, scales, and translates.<br />

In this chapter, we're going to look at one <strong>of</strong> the new additions to HTML5—the<br />

element.<br />

The best way to think <strong>of</strong> the element is to treat it like the kind <strong>of</strong><br />

canvas on which an artist would paint. We can draw simple lines or complex<br />

shapes using JavaScript API methods, and there is also support for images<br />

and text. The canvas is two dimensional at this point, but may be extended to<br />

include 3D support in the future.<br />

The element, first proposed and used by Apple, has been<br />

implemented by most common browsers, and is considered one <strong>of</strong> the most<br />

stable elements from the HTML5 specification. However, support for it is not<br />

yet universal.<br />

Like CSS3 transforms, the element isn't supported in any current<br />

version <strong>of</strong> Internet Explorer (although it is supported in IE9), but just like<br />

transforms, there are alternatives that can be used in IE to create the same<br />

effect as , which we'll look at when we come to the examples a little<br />

later in the chapter.<br />

The best description <strong>of</strong> the element I've seen states "A canvas is<br />

a rectangle in your page where you can use JavaScript to draw anything you<br />

want", from diveintohtml5.org, which sums it up quite nicely I feel.

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

Saved successfully!

Ooh no, something went wrong!