liveBook · Manning

Canvas element

The HTML canvas element is a scriptable bitmap drawing surface in a web document, with an API for rendering graphics.

How 5 Manning books explain it

Web Components in Action

How it is used
Serves as the drawing surface for component-based 3D scenes and processed video frames.
How deep it goes
Shows canvas placement, engine setup, refresh timing, and pixel filtering, but leaves low-level drawing largely to libraries and components.
Examples
Uses a Babylon.js 3D scene and live-camera black-and-white and “snow” filters.
What you can do after
Apply it via Babylon.js or video components to render a scene or alter displayed camera frames.

Read how Web Components in Action explains canvas element →

D3.js in Action, Third Edition

The Canvas API is the browser scripting interface for drawing on and reading from an HTML canvas bitmap.

How it is used
Replaces numerous SVG marks with pixel drawing when dense visualizations, animations, or gradients make Canvas a useful performance choice.
How deep it goes
Works through element sizing, pixel density, 2D context setup, and pixel-based interaction; defers WebGL.
Examples
Uses a shape gallery for setup and a dense painting visualization for mixed rendering and hover detection.
What you can do after
Build it from scratch: size a canvas, obtain its 2D context, and plan interaction for drawings without individual DOM elements.

Read how D3.js in Action, Third Edition explains canvas element →

HTML5 in Action

The canvas element is an HTML element that provides a drawable region for graphics rendered by scripts.

How it is used
Uses a script-drawn region for interactive graphics and for combining or manipulating video imagery.
How deep it goes
Explains 2D drawing methods and a staged video-rendering workflow, including image processing and captured drawings.
Examples
Uses an interactive game and a video telestrator with image overlays, grayscale, and mouse-drawn annotations.
What you can do after
Build it from scratch by drawing interactive graphics or combining video frames with images and user drawings.

Read how HTML5 in Action explains canvas element →

Get Programming: Learn to code with Python

How it is used
Provides a drawing area for placing game shapes in a Tkinter window.
How deep it goes
Defines the canvas as a rectangular widget and demonstrates colored rectangles, but stops short of detailing its full drawing API.
Examples
Uses two randomly positioned, differently sized player rectangles in a tag game.
What you can do after
Build it from scratch by adding a canvas to a Tkinter window and placing shapes on it.

Read how Get Programming: Learn to code with Python explains canvas element →

Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond

An HTML element that provides a scriptable bitmap drawing surface for web graphics.

How it is used
Uses a canvas and its 2D context to paint images for a web gallery.
How deep it goes
Explains context setup, image drawing and alpha-based fading, without detailing canvas internals.
Examples
Draws an image across a gallery canvas, then fades it in by increasing alpha over animation frames.
What you can do after
Apply the Canvas 2D context to draw images and create a fade-in effect.

Read how Get Programming with JavaScript Next: New features of ECMAScript 2015, 2016, and beyond explains canvas element →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.