- ·上一篇文章:asp教程:正则过滤所有html内容但保留换行符
- ·下一篇文章:html5 canvas 线太粗的解决方法
html5 canvas 画虚线的方法
<
canvas id="mycanvas" width="520" height="400" style="border: 0px solid
#000
background-color:
#fff
">
<
/canvas>
<
script>
mycanvas=document.getElementById("mycanvas")
ctx = mycanvas.getContext("2d")
//画线
ctx.beginPath()
 
ctx.setLineDash([3, 3])
 
//画虚线
ctx.moveTo(100,100)
ctx.lineTo(200,100)
ctx.stroke()
ctx.closePath()
<
/script>
html5 canvas 画虚线的方法