初级执事
阅读权限 2
积分 1985
侠名
UID 43
主题
帖子
精华
好友
银子
金子
贡献
威望
推广
活跃
荣耀
注册时间 2017-11-7
最后登录 1970-1-1
在线时间 小时
个人主页
|
发表于 2019-11-1 17:50:44
|
显示全部楼层
...怎么看这帖子也裂了啊..
画扇形这个做法
- public static function drawSectorOn(mc:Sprite, xOffset:Number, yOffset:Number, innerRad:Number, outterRad:Number, rot:Number, radian:Number, color:Number=0x0033ff, alpha:Number = 0.35):void {
- var g:Graphics = mc.graphics;
- g.lineStyle(1,0, alpha);
- g.beginFill(color, alpha);
-
- if(radian >= 180){
- g.drawCircle(xOffset, yOffset, innerRad);
- g.drawCircle(xOffset, yOffset, outterRad);
- }else{
- var d:int = Math.ceil(radian*2 / 15);
- //内径
- var rot_RAD:Number = (90-rot+radian)*Gmath.TO_RAD;
- g.moveTo(xOffset+innerRad*Math.cos(rot_RAD), yOffset + innerRad*Math.sin(rot_RAD));
- for(var i:int = 1;i<=d;i++){
- rot_RAD = (90-rot+radian-(radian*2*i/d))*Gmath.TO_RAD;
- g.lineTo(xOffset+innerRad*Math.cos(rot_RAD), yOffset + innerRad*Math.sin(rot_RAD));
- }
- rot_RAD = (90-rot-radian)*Gmath.TO_RAD;
- g.lineTo(xOffset+outterRad*Math.cos(rot_RAD), yOffset + outterRad*Math.sin(rot_RAD));
- for(i = d;i>=0;i--){
- rot_RAD = (90-rot+radian-(radian*2*i/d))*Gmath.TO_RAD;
- g.lineTo(xOffset+outterRad*Math.cos(rot_RAD), yOffset + outterRad*Math.sin(rot_RAD));
- }
- rot_RAD = (90-rot+radian)*Gmath.TO_RAD;
- g.lineTo(xOffset+innerRad*Math.cos(rot_RAD), yOffset + innerRad*Math.sin(rot_RAD));
- }
- g.endFill();
- }
复制代码 |
|