08非零环遥原则

2016-12-07  本文已影响13人  夜幕小草
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>非零环绕原则</title>
</head>
<body style="padding: 100px;">
  <canvas id="canvas" width="900" height="600" style="border:1px solid #000"></canvas>

<script>
     // 1. 获取标签
    var canvas = document.getElementById("canvas");
    var ctx = canvas.getContext("2d");

     // 2.绘制圆环
     // 内圆
    ctx.beginPath();
    ctx.arc(200, 200, 100, 0, 360 * Math.PI / 180, false);

     // 外圆
     ctx.arc(200, 200, 200, 0, 360 * Math.PI / 180, true);
     ctx.fillStyle = 'orange';
     ctx.fill();
</script>
</body>
</html>

、、此外:false表示内环
true表示外环
arc(x , y, 半径,起始角度,终点角度,内外环)

上一篇 下一篇

猜你喜欢

热点阅读