function drawStart(d:Number,numPoint:uint,sx:Number,sy:Number):void
{
//d=20;
var angle:Number=-90;
var r:Number=d / 2;
graphics.beginFill(0xffff0000,1);
graphics.moveTo(sx,-d+sy);
for(var i=0;i<numPoint*2;i++)
{
angle+=360/(numPoint*2);
var to_x:Number;
var to_y:Number;
var radian:Number=angle * Math.PI / 180;
if (i % 2)
{
to_x=d * Math.cos(radian);
to_y=d * Math.sin(radian);
}
else
{
to_x=r * Math.cos(radian);
to_y=r * Math.sin(radian);
}
graphics.lineTo(to_x+sx, to_y+sy);
}
graphics.endFill();
}
AS3画五角星一类的算法实现函数
最新推荐文章于 2024-04-07 07:19:38 发布