LeetCode 507——完美數
阿新 • 來源:網路 • 發佈:2021-02-16
技術標籤:JS曲線javascript
在畫布上建立介於兩個切線之間的弧

<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="300" height="200" style="border:1px solid #d3d3d3;">
Your browser does not support the HTML5 canvas tag.
</canvas>
<script>
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.beginPath();
ctx.beginPath();
ctx.moveTo(20,20); // 建立開始點1;
ctx.lineTo(100,20); // 建立水平線
ctx.arcTo(150,20,150,70,50); // 建立弧
//(150,20)弧的起點座標2;(150,70)弧的終點座標3;
ctx.lineTo(150,120); // 建立垂直線
ctx.arcTo(150,200,100,200,50); // 建立弧
ctx.lineTo(20,200); // 建立水平線
ctx.stroke();
</script>
</body>
</html>
