© Mark J. Collins 2017

Mark J.  Collins, Pro HTML5 with CSS, JavaScript, and Multimedia, 10.1007/978-1-4842-2463-2_23

23. Canvas

Mark J. Collins

(1)Chesterfield, Virginia, USA

In this chapter, I’ll show you 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 ...

Get Pro HTML5 with CSS, JavaScript, and Multimedia: Complete Website Development and Best Practices now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.