Viewers: in countries Watching now:
One of the most exciting additions that HTML5 offers to designers is the ability to draw free-form graphics on a drawing surface known as the Canvas. In this course, author Joe Marini introduces the technical concepts behind Canvas and shows how to perform drawing operations directly in a web page. The course covers drawing basic and complex shapes, setting colors and styles, adding shadows, patterns, and gradients, more advanced techniques such as scaling, rotating, and compositing objects, and how to incorporate Canvas elements in a slideshow and an animation.
Since the canvas tag is new to HTML5, there are going to be browsers out there that don't support it. So let's take a quick look at what happens when a browser that is not aware of the canvas tag encounters one in a document. So here we have a canvas, and inside we have some text. Now in browsers that understand what the canvas tag is, this text will not show up and will instead be replaced by the canvas itself in the rendering surface. A browser that does not understand the canvas tag will ignore it and render the contents of the interior of the canvas tag instead.
In this case, let's just quickly show you what I'm talking about. What I'm going to do is simulate a browser that does not understand canvas, since all the browsers I have on this machine know about it. So I'll just quickly comment this out and will comment this one out as well. This is pretty much how the browser will treat the canvas tag if it doesn't recognize it. So now let's just quickly take a look at that. So you can see that in the case where a browser doesn't know what the canvas tag is, the interior text gets rendered instead.
So that will happen in cases where you have an older browser and it comes across a canvas tag, or generally speaking, pretty much any tag it doesn't recognize. But in the case where the browser does understand what the canvas tag is-- let's go back and uncomment it, save--and you can see that I've got a style defined for this canvas up here with a dotted 3-pixel black border and a background color. So it should render as a gray square with a border.
Let's go back to the browser and refresh. So I am going to refresh this now, and you can see that in a browser that does understand the canvas tag, it does show up, and it's properly styled.
There are currently no FAQs about HTML5: Graphics and Animation with Canvas.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.