码迷,mamicode.com
首页 > 其他好文 > 详细

17-canvas绘制扇形

时间:2020-01-08 14:29:55      阅读:81      评论:0      收藏:0      [点我收藏+]

标签:set   stroke   height   span   head   工具   mat   auto   pre   

 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绘制扇形

标签:set   stroke   height   span   head   工具   mat   auto   pre   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!