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

绘制圆弧的几种简单方法

时间:2016-03-11 12:00:04      阅读:409      评论:0      收藏:0      [点我收藏+]

标签:

 

展示图:技术分享

 

//绘制圆弧  true:逆时针  false:顺时针
context.lineWidth=5;
context.strokeStyle="pink";                                                      
context.arc(40,40,30,0,Math.PI*2);
context.stroke();//外环是粉色的圆,无填充色


context.beginPath();
context.strokeStyle="yellow";
context.fillStyle="red";
context.arc(100,40,30,0,Math.PI*2);
context.fill();
context.stroke();//外环是黄色,内填充是red

context.beginPath();
context.strokeStyle="yellow";
context.fillStyle="red";
context.arc(180,40,30,0,Math.PI/3,true);
context.stroke(); //外环是黄色

context.beginPath();
context.strokeStyle="yellow";
context.fillStyle="red";
context.arc(260,40,30,0,Math.PI/3,true);
context.fill();//内填充是red的60度的弧

context.beginPath();
context.strokeStyle="yellow";
context.fillStyle="red";
context.arc(260,100,30,0,Math.PI/3,true);
context.fill();
context.stroke();//外环是黄色,内填充是red的60度的弧

 

绘制圆弧的几种简单方法

标签:

原文地址:http://www.cnblogs.com/Litter-Tulip/p/5264880.html

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