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

forked from: Random Green Tree (smaller flowers)

frocessingの勉強のためにforkeしてみました。
// forked from makc3d's Random Green Tree (smaller flowers)
// forked from makc3d's Random Green Tree
/*frocessingの勉強のためにforkeしてみました。*/
package {
	import frocessing.display.*;
	public class FlashTest extends F5MovieClip2D{
		private var level:int = 0;
		public function FlashTest() {
			//super();
		}
		
		public function setup():void {
			drawTree (stage.stageWidth/2, stage.stageHeight, 90, -90, 0xF00);
		}
		
//		public function draw():void{
//			
//		}
		
		// just some random tree :)
		private function drawTree (x:Number, y:Number, length:Number, angle:Number, cf:int):void {
			level += 1;
			
			var destx:Number = x + length * Math.cos(angle * (Math.PI/180));
			var desty:Number = y + length * Math.sin(angle * (Math.PI/180));
			
			// for the most of time, we use green,
			// but sometimes pink to make flowers
			if ((level == 10) && (Math.random () < 0.5)) cf = 0xF0007;

			strokeWeight(1+5/level);
			stroke(cf*level);
			line(x,y,destx,desty);
			
			
			if (level < 10) {
				drawTree (destx, desty, length * (1 + 3 * Math.random()) * 0.25,
					angle + 60 * (Math.random() - Math.random()), cf);
				drawTree (destx, desty, length * (1 + 3 * Math.random()) * 0.25,
					angle + 60 * (Math.random() - Math.random()), cf);
				drawTree (destx, desty, length * (1 + 3 * Math.random()) * 0.25,
					angle + 60 * (Math.random() - Math.random()), cf);
			}
			
			level -= 1;
		}
	}
}