- ·上一篇文章:html5 canvas 画虚线的方法
- ·下一篇文章:使用html5的fillRect和setTransform画立方体
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.translate(0.5,0.5)
//html5 canvas 
线太粗的解决方法
//画矩形
ctx.beginPath()
 
//这行必须有,不然看不到效果
ctx.lineWidth = 1
ctx.strokeRect(100,100,200,200)
ctx.closePath()
<
/script>
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.translate(0.5,0.5)
//html5 canvas 
线太粗的解决方法
//画矩形
ctx.beginPath()
 
//这行必须有,不然看不到效果
ctx.lineWidth = 1
ctx.strokeRect(100,100,200,200)
ctx.closePath()
<
/script>
html5 canvas 线太粗的解决方法