Animating the canvas

The <canvas> methods we've looked at so far are easy to use and nothing if not a little repetitive. Animating the objects on the <canvas> is where things start to get interesting. Animating is harder than simply drawing on the <canvas> and as we have no real way of debugging it other than trial and error, solving bugs can quickly become problematic and somewhat time-consuming.

In our flag example, there was no real benefit to using the <canvas>. We could have got exactly the same effect, with much less code and processing, by simply including an image of the flag on our page. However, animating the <canvas> is where its benefits really begin. This is where we can do much more than anything we could achieve with a simple image. ...

Get jQuery 1.4 Animation Techniques Beginner's Guide 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.