获得徽章 6
- 打扰兄弟们摸鱼下。canvas如果使用的不是整形,就有间隙,这个有没有办法处理呢?
// 获取 canvas 元素
var canvas = document.getElementById('canvas');
// 通过判断getContext方法是否存在来判断浏览器的支持性
if(canvas.getContext) {
// 获取绘图上下文
var ctx = canvas.getContext('2d');
// 绘制一个填充矩形
ctx.fillStyle='green'
ctx.fillRect(100, 0, 100.222, 100);
ctx.fillStyle='green'
ctx.fillRect(200.222, 0, 100, 100);
ctx.fillStyle='green'
ctx.fillRect(300.222, 0, 100, 100);
}展开45
![[打哈欠]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_44.74cc36f.png)
![[斜眼]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_66.fb6750b.png)
![[白眼的狗]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_98.9f6d4ad.png)
![[流泪]](http://lf-web-assets.juejin.cn/obj/juejin-web/xitu_juejin_web/img/jj_emoji_6.dde0d83.png)