In case Flash no longer exists; a copy of this site is included in the Flashpoint archive's "ultimate" collection.

Dead Code Preservation :: Archived AS3 works from wonderfl.net

この木なんの木キモい木

Get Adobe Flash player
by undo 18 Jun 2010
package
{
	import flash.display.Sprite;
	import flash.display.StageAlign;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.geom.Point;
	
	[SWF(width='465',height='465')]
	public class Test extends Sprite
	{
		private var _omega:Number = Math.PI/5;//枝の開き具合
		private var _devPer:Number = 1/4;//枝が開くまでの長さ
		private var _devideTime:int = 10;//枝わかれする回数 15くらいを超えると重いよ!
		
		
		public function Test()
		{
			addEventListener(Event.ADDED_TO_STAGE, init);
		}
		private function init(evt:Event = null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			this.stage.align = StageAlign.TOP_LEFT;
			this.stage.scaleMode = StageScaleMode.NO_SCALE;
			
			//this.graphics.lineStyle(0,0);
			drawLine(new Point(230,350),new Point(230,50), this._devideTime);
		}
		
		private function drawLine(pa:Point, pb:Point, devide:int):void
		{
			this.graphics.lineStyle(devide, Math.random()*0xffffff);
			this.graphics.moveTo(pa.x,pa.y);
			var def:Point = new Point(pb.x-pa.x,pb.y-pa.y);
			this.graphics.lineTo(pa.x + def.x*this._devPer,pa.y + def.y*this._devPer);
			if(devide != 0)
			{
				var radian:Number = Math.atan2(def.y, def.x);
				var radius:Number = Math.sqrt(def.x*def.x*(1-this._devPer)*(1-this._devPer) + def.y*def.y*(1-this._devPer)*(1-this._devPer));
				this.drawLine(new Point(pa.x + def.x*this._devPer,pa.y + def.y*this._devPer),new Point(pa.x + def.x*this._devPer + Math.cos(radian+this._omega)*radius, pa.y + def.y*this._devPer + Math.sin(radian+this._omega)*radius),devide-1);
				this.drawLine(new Point(pa.x + def.x*this._devPer,pa.y + def.y*this._devPer),new Point(pa.x + def.x*this._devPer + Math.cos(radian-this._omega)*radius, pa.y + def.y*this._devPer + Math.sin(radian-this._omega)*radius),devide-1);
			}
		}
	}
}