专题文章
时长:00:00更新时间:2020-11-27 20:05:59
因为canvas的api没有虚线的。所以需要自己实现;顺便复习一下三角函数岂不美滋滋。,var context=document.getElementById(";canvas";).getContext(";2d";);function drawDashedLine(context,x1,y1,x2,y2,y1+everydashLength_y*i) } context.stroke()}context.lineWidth=3context.strokeStyle=";blue";drawDashedLine(context,20,20,context.canvas.width-20,20,20)。效果如图;
查看详情