Skip to main content

Canvas Pocket Reference: Scripted Graphics for HTML5

Use HTML5's Canvas element to program games.


"The Canvas tag is a revolutionary advance in what we can do with web browsers," says author David Flanagan . "I really do think that the client-side graphics enabled by the Canvas tag has the potential to change the web. The Canvas tag is one of the most important features of HTML5. And, it's fun to program!"

"Readers will learn everything they need to know about scripted client-side graphics and will be able to draw whatever they want in their web pages: this might be scientific data visualizations, a video game, or cool special effects. In short, readers will learn to master their pixels!"

This book provides both a tutorial that covers all of the element's features with plenty of examples and a definitive reference to each of the Canvas-related classes, methods, and properties.

You'll learn how to:

Draw lines, polygons, and curves Apply colors, gradients, patterns, and transparency Use transformations to smoothly rotate and resize drawings Work with text in a graphic environment Apply shadows to create a sense of depth Incorporate bitmapped images into vector graphics Perform image processing operations in JavaScript "The Canvas tag," Flanagan promises, "makes web programming fun again."

Speaking of fun, try David's holiday bookmarklet , a marvelous example of splendid Canvas coding.

About the Author

David Flanagan is a computer programmer who spends most of his time writing about JavaScript and Java. His books with O'Reilly include JavaScript: The Definitive Guide, JavaScript Pocket Reference, Java in a Nutshell, Java Examples in a Nutshell, and Java Foundation Classes in a Nutshell. David has a blog at

View David Flanagan's full profile page.

Additional Resources

For more information about the book, including table of contents, author bios, and cover graphic, see:

  Canvas Pocket Reference

Publisher: O'Reilly Media

By David Flanagan

Print ISBN: 9781449396800   Ebook ISBN: 9781449397197  

Pages: 112

Print Price: $12.99, £9.99, 10 €

Read this next avatar GamesIndustry International is the world's leading games industry website, incorporating and