Chapter 8Canvas

This chapter introduces the <canvas> element, which is part of the HTML5 specification. We’ll be using <canvas> to implement a productivity chart for our example application. The chart will update each time the data is changed. This will show the user how many tasks have been completed and how many remain unfinished. We’ll also add some shadowing and gradient effects to give our charts a more polished look.

What is Canvas?

The official specification states: “The canvas element provides scripts with a resolution-dependent bitmap canvas, which can be used for rendering graphs, game graphics, art, or other visual images on the fly.” Although the specification does not mandate an actual scripting language, JavaScript is generally ...

Get Jump Start JavaScript now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.