首页 > 其他 > 详细

17-canvas绘制扇形

时间:2020-01-08 14:36:54      阅读:72      评论:0      收藏:0      [点我收藏+]
 1 <!DOCTYPE html>
 2 <html lang="en">
 3 <head>
 4     <meta charset="UTF-8">
 5     <title>17-Canvas绘制扇形</title>
 6     <style>
 7         *{
 8             margin: 0;
 9             padding: 0;
10         }
11         canvas{
12             display: block;
13             margin: 0 auto;
14             background: red;
15         }
16     </style>
17 </head>
18 <body>
19 <canvas width="500" height="400"></canvas>
20 <script>
21     // 1.拿到canvas
22     let oCanvas = document.querySelector("canvas");
23     // 2.从canvas中拿到绘图工具
24     let oCtx = oCanvas.getContext("2d");
25     oCtx.moveTo(100, 100);
26     oCtx.arc(100, 100, 100, 0, Math.PI/2);
27     oCtx.closePath();
28     // oCtx.stroke();
29     oCtx.fill();
30 </script>
31 </body>
32 </html>

17-canvas绘制扇形

原文:https://www.cnblogs.com/gsq1998/p/12166149.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!