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: 再帰関数

Get Adobe Flash player
by ohisama 03 Feb 2013
// forked from clockmaker's 再帰関数
// forked from makc3d's Random Green Tree (smaller flowers)
// forked from makc3d's Random Green Tree
package 
{
    import flash.display.Sprite;
    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));
                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, 85, -85, 0xF00);
        }
    }
}