9 THE CANVAS ELEMENT

One of the more interactive elements in HTML is the canvas element. This element acts like a painter’s canvas: it provides space for you to draw images within the browser window using JavaScript. What’s more, by repeatedly erasing old images and drawing new ones, you can create animations on the canvas. In this sense, the canvas element is more like the screen at a movie theater, where the image is updated many times every second to create the appearance of motion.

In this chapter you’ll learn how to create canvas elements and how to use the Canvas API, which gives you a way to manipulate the canvas via JavaScript. You’ll ...

Get JavaScript Crash Course 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.