flash on 2010-2-10
800x600 黑色背景
夏天的树人
/**
* Copyright summerTree ( http://wonderfl.net/user/summerTree )
* MIT License ( http://www.opensource.org/licenses/mit-license.php )
* Downloaded from: http://wonderfl.net/c/3gWp
*/
package
{
//800x600 黑色背景
//夏天的树人
import flash.display.Sprite;
import flash.events.*;
import flash.geom.*;
public class Main extends Sprite
{
private var pen:Sprite=new Sprite();//画笔
private var num:int=20;
private var n:int=11;
private var startX:Number=400;
private var startY:Number=300;
private var nodes:Array=new Array();
private var R:Number=300;
private var angle:Number=-2*Math.PI/n;
public function Main()
{
addChild(pen);
creatSprite();
}
private function creatSprite():void
{
pen.graphics.lineStyle(2,0x8080ff);//定义画笔粗糙和颜色
for (var i:int=0; i<n+1; i++)
{
nodes[i]=new Array();
for (var j:int=0; j<num; j++)
{
var point:Point=new Point(j*10*Math.cos(angle*i)+startX,j*10*Math.sin(angle*i)+startY);
nodes[i][j]=point;
pen.graphics.moveTo(point.x,point.y);
if(i==0)
pen.graphics.lineTo((num-j)*10+startX,startY);
else
{
pen.graphics.lineTo(nodes[i-1][num-1-j].x,nodes[i-1][num-1-j].y);
}
}
}
}
}
}