beginPath
beginPath is a method of the CanvasRenderingContext2D interface used in HTML5 canvas drawing. It starts a new path by emptying the current list of subpaths, effectively resetting the existing path without affecting the canvas content. After calling beginPath, subsequent drawing commands build a new path from scratch.
The method takes no arguments and does not itself render anything. To produce visible output, you must
beginPath is commonly used when drawing several shapes in sequence. By starting a new path before each
In practice, typical usage follows a pattern such as: beginPath, define the path with moveTo and line