Complex and irregular shapes can be drawn as canvas paths, generated by placing an “invisible ink” pen at a specific location and defining straight lines, arcs, or curves to build a shape. That shape can be filled or stroked, which draws it to screen.
All paths must begin with beginPath(). This removes all points established by any earlier paths. Note that previously drawn paths will remain on the canvas; this function just removes any of the analogous invisible ink.
Path-generation methods allow you to control your invisible ink pen: