Submodule 15.1: Canvas HTML element

  • Text
  • Drawing
  • Image

What is Canvas

The HTML5 canvas element or just canvas is exactly what the name implies—it's a space where you draw (and edit) both images and text.Specifically, with the terms images and text, we mean their representation in terms of a bitmap—the actual pixels that create the image on the screen.

Imagine the canvas as a workspace. Its name, "canvas" reminds us of the painting sheet. However, it would be better to imagine it as the stretcher bars that support the canvas sheet. To actually draw, you need a surface. This surface is the  canvasRenderingContext2D where we actually draw on.