Paths drawn on an HTML5 Canvas is simply a series of points with drawing instructions between those points. For example, there can be a series of points defined on the canvas with lines or arcs drawn between them. Paths can be used to draw various types of shapes such as lines, circles, rectangles, and other multi-sided polygons.

To create a path onto the HTML5 Canvas, we can connect multiple subpaths. The ending point of each new subpath becomes the new context point.

We can use many methods to achieve this such as the lineTo(), arcTo(), quadraticCurveTo(), and bezierCurveTo() methods. We can also use the beginPath() method each time we want to start drawing a new path and closePath().

Quadratic Curves

To draw a quadratic curve onto the HTML5 Canvas, we can use the quadraticCurveTo() method.

Quadratic curves are defined by the starting point, a control point, and an ending point.

Your browser does not support the HTML5 canvas tag.

bezierCurveTo()

To draw a bezier curve onto the HTML5 Canvas, we can use the bezierCurveTo() method.

Bezier curves are defined by the starting point, two control points, and an ending point.

Your browser does not support the HTML5 canvas tag.

Cloud Example

In this example, we will use bezier curves to draw a simple cloud.

Your browser does not support the HTML5 canvas tag.