当前位置:K88软件开发文章中心编程语言Html5Html501 → 文章内容

html5 canvas 线太粗的解决方法

减小字体 增大字体 作者:wangsdong     来源:asp编程网  发布时间:2018-12-30 8:42:05

<
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 线太粗的解决方法