如何去除strokeRect画矩形时的默认的线条呢?
来源:7-2 编程练习
gaogao_
2017-11-16 17:40:23

3回答
把这些代码注释掉就可以,不需要设置

gaogao_
提问者
2017-11-16
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Document</title>
<style>
canvas{background-color:lightblue;}
</style>
</head>
<body>
<canvas id="canvas" width="800px" height="800px">
您的浏览器不支持canvas
</canvas>
<script>
var canvas=document.getElementById("canvas");
var context=canvas.getContext("2d");
// 在此处补充代码
context.beginPath();
context.moveTo(400,400);
context.arc(400,400,200,0,Math.PI*2,true);
context.clip();
context.strokeRect(200,200,200,200);
context.fillStyle="#7ff9a1";
context.fillRect(200,200,200,200);
context.strokeRect(400,200,200,200);
context.fillStyle="#7b4ab8";
context.fillRect(400,200,200,200);
context.strokeRect(200,400,200,200);
context.fillStyle="#f0953c";
context.fillRect(200,400,200,200);
context.strokeRect(400,400,200,200);
context.fillStyle="#e39ccc";
context.fillRect(400,400,200,200);
</script>
</body>
</html>
就是strokeRect默认给每个矩形描边了,怎么消除这种描边?
小丸子爱吃菜
2017-11-16
你可以将你写的代码粘贴过来,我们看下是什么情况!
祝学习愉快!
相似问题