O'Reilly logo

Pro HTML5 with Visual Studio 2012 by Mark Collins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

CHAPTER 10

image

Canvas

In this chapter I’ll show how to use the canvas element in HTML5 to create some fun graphics. As you’ll see, it is very different from SVG, which you explored in the previous chapter. I will discuss the differences in more detail later but the main thing you’ll notice is that canvas is completely implemented in JavaScript. The only part that is in the markup is a simple element definition like this:

<canvas id="myCanvas" width="400" height="400">    Canvas is not supported on this browser</canvas>

Instead, you’ll define the content by calling the various drawing methods using JavaScript. Just like with the audio and video elements, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required