var canvas=document.getElementById("canvas");
var canvas=document.getElementById("canvas");
var cxContextcan. ("2d");
cxt.beginPath();
cxt.moveTo(250,50);
cxt.lineTo(200,200);
cxt.lineTo(300,300); //空心三角形
cxt.strokeStyle="red";
cxt.stroke();
//實心三角形
cxt.beginPath();
cxt.moveTo(350,50);
cxt.lineTo(300,200);
cxt.lineTo(400,300); cxt.lineTo(400,300); cxt.fill();