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

F5 Tree Sample

processing samplle の アレ
// write as3 code here..
// processing samplle の アレ
package{
    import flash.display.*;
    import flash.events.*;
    import frocessing.core.F5Graphics2D;
    import frocessing.math.FMath;

    [SWF(frameRate="30", backgroundColor="#000000")] 
    public class F5TreeSample extends Sprite
    {
        private var fg:F5Graphics2D;
        private var theta:Number;

        public function F5TreeSample() 
        {
            fg = new F5Graphics2D(graphics);
            fg.stroke(255,0.5);
            addEventListener( Event.ENTER_FRAME, draw );
        }

        private function draw(e:Event):void
        {
            var a:Number = (mouseX / stage.stageWidth ) * 90;
            var h:Number = 150 - ( mouseY / stage.stageHeight) * 50;
            theta = FMath.radians(a);
            fg.beginDraw();
            fg.translate(stage.stageWidth*0.5, stage.stageHeight);
            fg.line(0, 0, 0, -h);
            fg.translate(0, -h);
            branch( h*0.9 );
            fg.endDraw();
        }

        private function branch( h:Number ):void
        {
            h *= 0.66;
            if (h > 2)
            {
                fg.pushMatrix();
                fg.rotate(theta);
                fg.line(0, 0, 0, -h);
                fg.translate(0, -h); 
                branch(h);       
                fg.popMatrix();
    
                fg.pushMatrix();
                fg.rotate(-theta);
                fg.line(0, 0, 0, -h);
                fg.translate(0, -h);
                branch(h);
                fg.popMatrix();
            }
        }
    }
}