Chapter 6. Making Canvas Interactive and Stateful

Now that we’ve covered the entire canvas API, we take a look at animating the canvas and making it interactive.

Nearly all interactive canvas applications are event driven, typically by a combination of mouse, touch device, or keyboard events. Retrieving coordinates from input devices is not always an intuitive exercise, so we examine our options for handling mouse and touch events in the canvas.

This chapter then talks about the JavaScript options for animation, covering some relatively new JavaScript methods in the process. We give examples of how to draw at a specified ...

Get HTML5 Unleashed 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.