You are previewing Learning HTML5 Game Programming: Build Online Games with Canvas, SVG, and WebGL.

Learning HTML5 Game Programming: Build Online Games with Canvas, SVG, and WebGL

Cover of Learning HTML5 Game Programming: Build Online Games with Canvas, SVG, and WebGL by James L. Williams Published by Addison-Wesley Professional
O'Reilly logo

6. Creating Games with SVG and RaphaëlJS

One of the problems we saw when creating games with Canvas was that we had to independently track mouse interactions and locations of the drawn objects after rendering was complete. Scalable Vector Graphics (SVG) addresses these concerns by giving us a means to draw objects while retaining their locations as well as to receive events and modify them. In this chapter, you learn the essentials of SVG to get started in creating games. We also discuss how it compares to Canvas in regard to rendering capabilities and the subset of SVG that most clients implement.

Introduction to SVG

Compared to other elements of HTML5, SVG is a relatively mature component, first released in 2001, with its most recent release ...

The best content for your career. Discover unlimited learning on demand for around $1/day.