Skip to Content
Core HTML5 Canvas: Graphics, Animation, and Game Development
book

Core HTML5 Canvas: Graphics, Animation, and Game Development

by David Geary
May 2012
Intermediate to advanced
752 pages
20h 24m
English
Pearson

Overview

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

  • Shapes—drawing, dragging, erasing, and editing lines, arcs, circles, curves, and polygons; using shadows, gradients, and patterns

  • Text—drawing, positioning, setting font properties; building text controls

  • Images—drawing, scaling, clipping, processing, and animating

  • Animations—creating smooth, efficient, and portable animations

  • Sprites—implementing animated objects that have painters and behaviors

  • Physics—modeling physical systems (falling bodies, pendulums, and projectiles), and implementing tweening for nonlinear motion and animation

  • Collision detection—advanced techniques, clearly explained

  • Game development—all aspects of game development, such as time-based motion and high score support, implemented in a game engine

  • Custom controls—infrastructure for implementing custom controls; implementing progress bars, sliders, and an image panner

  • Mobile applications—fitting Canvas apps on a mobile screen, using media queries, handling touch events, and specifying iOS5 artifacts, such as app icons

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.

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Physics for JavaScript Games, Animation, and Simulations: with HTML5 Canvas

Physics for JavaScript Games, Animation, and Simulations: with HTML5 Canvas

Dev Ramtal, Adrian Dobre
HTML5 Canvas, 2nd Edition

HTML5 Canvas, 2nd Edition

Steve Fulton, Jeff Fulton

Publisher Resources

ISBN: 9780132761635Purchase book