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

再帰関数

coppieeeさんの書き方を使ってみた
http://twitter.com/coppieee/status/4940999170
※ 表現はmakc3dさんのものと変わりません
// forked from makc3d's Random Green Tree (smaller flowers)
// forked from makc3d's Random Green Tree
package {
    import flash.display.Sprite;
    /*
    * coppieeeさんの書き方を使ってみた
    * http://twitter.com/coppieee/status/4940999170
    * ※ 表現はmakc3dさんのものと変わりません
    */
    public class Main extends Sprite {
        
        public function Main(){
            var level:int = 0;
            
            (function (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;
                
                graphics.lineStyle(1 + 5 / level, cf * level);
                graphics.moveTo(x, y);
                graphics.lineTo(destx, desty);
                
                if (level < 10) {
                    arguments.callee(destx, desty, length * (1 + 3 * Math.random()) * 0.25,
                        angle + 60 * (Math.random() - Math.random()), cf);
                    arguments.callee(destx, desty, length * (1 + 3 * Math.random()) * 0.25,
                        angle + 60 * (Math.random() - Math.random()), cf);
                    arguments.callee(destx, desty, length * (1 + 3 * Math.random()) * 0.25,
                        angle + 60 * (Math.random() - Math.random()), cf);
                }
                
                level -= 1;
            })(stage.stageWidth / 2, stage.stageHeight, 90, -90, 0xF00);
        }
    }
}