Canvas: The 2D Context

The canvas element in HTML is a complex beast. The specification was originally meant to cover both two- and three-dimensional contexts. However, as of the writing of this book, the 3D context was split from the original specification and reorganized under a new specification named WebGL. If you are working in three-dimensional space, you will use the “webgl” context, and if you are working in two-dimensional space, you will use the “2d” context. The webgl context is developing quite quickly, and there are some absolutely beautiful examples of using the 3D context on the web. However, its use in HTML5 games lags behind the 2D context by quite a lot. Not only are browsers still working on the implementations and details ...

Get Beginning Facebook Game Apps Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.