The HTML5 canvas is a fantastic feature that allows you to code programmatic drawing operations. It has become very popular because it allows you to create and manipulate imagery directly within web pages. The canvas is one of the most flexible tags in new HTML5 features. This tag is a blank state. It defines a context object that users can draw inside. The actual drawing operations can be split in the following ways:

  • Drawing a 2D context
  • Drawing a 3D context formally known as a WebGL

A 2D context is available in all modern web browsers. It is more established and stable, while the 3D context is in the early process of being defined. Let's discuss the 2D context as it is more widely supported.

The canvas API is simple and powerful at the same ...

Get Dart: Scalable Application Development now with the O’Reilly learning platform.

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