Core HTML5 Canvas: Graphics, Animation, and Game Development (Core Series)

By David Geary
Published May 2012List Price:$59.99, Your Amazon.com Price: $37.45

Amazon.com Sales Rank:513,506Availability: Usually ships in 24 hours

Summary:One of HTML5'''s most exciting features, Canvas provides a powerful 2D graphics API that lets you implement everything from word processors to video games. In Core HTML5 Canvas, best-selling author David Geary presents a code-fueled, no-nonsense deep dive into that API, covering everything you need to know to implement rich and consistent web applications that run on a wide variety of operating systems and devices.

Succinctly and clearly written, this book examines dozens of real-world uses of the Canvas API, such as interactively drawing and manipulating shapes, saving and restoring the drawing surface to temporarily draw shapes and text, and implementing text controls. You'''ll see how to keep your applications responsive with web workers when you filter images, how to implement smooth animations, and how to create layered, 3D scrolling backgrounds with parallax. In addition, you'''ll see how to implement video games with extensive coverage of sprites, physics, collision detection, and the implementation of a game engine and an industrial-strength pinball game. The book concludes by showing you how to implement Canvas-based controls that you can use in any HTML5 application and how to use Canvas on mobile devices, including iOS5. This authoritative Canvas reference covers

The canvas element'''using it with other HTML elements, handling events, printing a canvas, and using offscreen canvases

Throughout the book, Geary discusses high-quality, reusable code to help professional developers learn everything they really need to know, with no unnecessary verbiage. All of the book'''s code and live demonstrations of key techniques are available at corehtml5canvas.com.

GDNet Staff Review:If you are in any way excited about the present or future of game development in HTML5, you will need to acquaint yourself with the HTML5 Canvas. Canvas is an object that places an empty area of defined size on the screen, and it includes a host of functions to draw on it. If you are used to more traditional development where you have a big empty "something" upon which you must draw everything, you get the idea.

Core HTML5 Canvas: Graphics, Animation, and Game Development is a very complete tutorial and handbook about how to build a game using the Canvas object. It is a beautifully-presented guide to drawing using the Canvas object, with a focus on game development. While the book would work fine if you, for example, wanted to draw bar-graphs with Canvas, it does include information on input and sound and the "Ungame" (more on that later), which are necessary for a non-trivial game.

Probably the best thing about Core HTML5 Canvas is something you do not even have to buy. It's the book's companion website at corehtml5canvas.com. On the site you can check out sample chapters of the book as well as source code to all the examples and browser-viewable versions of all of the samples. If you are on the fence as to whether or not the book will give you the information you need, the website should answer your questions.

One thing Core HTML5 Canvas has that I wish more books would have is the "Ungame". That is a game pruned down to its most trivial elements. Because a game is more than just a level with jumping Marios. It is generally a main menu, gameplay, scorekeeping, actions taken on victory/defeat conditions, recording high scores, and returning back to that main menu again. And believe me, it is easy to get so bogged down in the presentation and play of your game that you find yourself neglecting the actual state-machine that must exist outside the level. The author builds a trivial game that he calls "The Ungame", which is everything that a game is minus the actual gameplay itself. If you start building from the Ungame into a playable level rather than the other way around, you can avoid a lot of refactoring later.

Core HTML5 Canvas: Graphics, Animation, and Game Development is a terrific guide to building HTML5 games using the Canvas object. And while the worth of HTML5 for games is still very much evolving at the time of this review, there is no doubt that it will remain a technological heavy-hitter. So you'll need to know it.