4-9 圆形边框
来源:4-10 编程练习
BruinK
2018-06-19 10:56:43
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>案例</title>
<style>
canvas{background-color:lightblue;}
</style>
</head>
<body>
<canvas id="canvas" width="600px" height="600px">您的浏览器不支持</canvas>
<script>
var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
ctx.translate(300,300);
ctx.fillStyle="#ffb6c1";
ctx.arc(0,0,100,0,2*Math.PI,true);
ctx.fill();
for(var i=0;i<4;i++){
ctx.rotate(Math.PI/2);
ctx.moveTo(90,0);
ctx.lineTo(100,0);
}
ctx.moveTo(0,0);
ctx.lineTo(80,0);
ctx.moveTo(0,0);
ctx.lineTo(0,-70);
ctx.stroke();
</script>
</body>
</html>这个圆形的外边框怎么去掉?

1回答
你好,如下,添加beginPath()

祝学习愉快~
相似问题