HTML canvas closePath() Method
Example
let c = document.getElementById("myCanvas");
let ctx = c.getContext("2d");
ctx.beginPath();
ctx.moveTo(25, 25);
ctx.lineTo(25, 100);
ctx.lineTo(100, 100);
ctx.closePath();
ctx.stroke();
Meaning
The closePath() method creates a path from the current point back to the starting point.
Standard Syntax
JavaScript syntax:
context.closePath(x,y);
Advertisement