<canvas> implementations which will be created in this tutorial.
This tutorial describes how to use the
<canvas> element to draw 2D graphics, starting with the basics. The examples provided should give you some clear ideas what you can do with canvas and will provide code snippets that may get you started in building your own content.
First introduced in WebKit by Apple for the OS X Dashboard,
<canvas> has since been implemented in browsers. Today, all major browsers support it.
Antes de começar
<canvas> element is not supported in some older browsers, but is supported in recent versions of all major browsers. The default size of the canvas is 300 px × 150 px (width × height). But custom sizes can be defined using the HTML
- Basic usage
- Drawing shapes
- Applying styles and colors
- Drawing text
- Using images
- Compositing and clipping
- Basic animations
- Advanced animations
- Pixel manipulation
- Hit regions and accessibility
- Optimizing the canvas
Uma nota para os colaboradores
Due to an unfortunate technical error that occurred the week of June 17, 2013, we lost the history of this tutorial, including attributions to all past contributors to its content. We apologize for this, and hope you'll forgive this unfortunate mishap.