📜  js ctx 虚线 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:25.429000             🧑  作者: Mango

代码示例1
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
ctx.setLineDash([5, 3]);/*dashes are 5px and spaces are 3px*/
ctx.beginPath();
ctx.moveTo(0,100);
ctx.lineTo(400, 100);
ctx.stroke();