Comment: html5 Canvas draw lines closePath() example code, friends who need it can refer to it
Core code:$(function(){
var can = $("#can").get(0);
var txi = can.getContext("2d");
txi.beginPath();
txi.moveTo(105,105);
txi.lineTo(105,45);
txi.lineTo(45,105);
txi.closePath();
txi.stroke();
txi.beginPath();
txi.moveTo(25,25);
txi.lineTo(100,25);
txi.lineTo(25,100);
txi.stroke();
})
<canvas></canvas>
closePath(); closePath(); closes the path
The following picture shows one used, closed, and the other is useless: