当前位置:asp编程网>技术教程>Html5教程>  正文

html5 canvas 线太粗的解决方法

2017-08-10 16:31:09   来源:www.aspbc.com   作者:wangsdong   浏览量:6525   收藏
<canvas id="mycanvas" width="520" height="400" style="border: 0px solid #000; background-color: #fff;"></canvas>
原创文章,转载请注明来源www.aspbc.com,谢谢
<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>

关于我们-广告合作-联系我们-积分规则-网站地图

Copyright(C)2013-2017版权所属asp编程网