答案 0 :(得分:1)
欢迎:)
以下是如何在JavaScript中使用canvas绘制线条的示例。希望它对你有用
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.moveTo(0,0);
ctx.lineTo(200,100);
ctx.stroke();

<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="100">
Your browser does not support the HTML5 canvas tag.</canvas>
</body>
</html>
&#13;
参考:w3schools