Beautifl - Flash Gallery

Thumbnail : f5 spline test 0
f5 spline test 0
nutsu 2009-08-28 All rights reserved

再生するにはFlash Playerが必要です。デスクトップのブラウザでご覧ください。

// write as3 code here..
package{
    import flash.display.*;
    import flash.events.Event;
    import frocessing.core.F5Graphics2D;
    import net.hires.debug.Stats;
    
    [SWF(frameRate="60", backgroundColor="#000000")]
    public class CurveTest0 extends Sprite
    {
        private var fg:F5Graphics2D;
        private var w:Number = 465;        
        private var n:int = 8;
        
        public function CurveTest0()
        {
            var d:Shape = addChild( new Shape() ) as Shape;
            fg = new F5Graphics2D( d.graphics );
            fg.noStroke();
            fg.curveDetail(30);
            addEventListener( Event.ENTER_FRAME, draw );
            //
            addChild(new Stats()); 
        }
        
        private var a:Number=0;
        private function draw( e:Event ):void
        {
            fg.beginDraw();
            fg.translate(w>>1,w>>1);
            fg.scale(  100*Math.sin(a/3)  );
            fg.curveTightness( 25*Math.cos(a) );
            fg.beginShape();
            for( var i:int=0; i<=n+2; i++ )
            {
                var rad:Number = i*Math.PI*2/n;
                fg.curveVertex( Math.sin(rad), Math.cos(rad) );
            }
            fg.endShape();
            fg.endDraw();
            a += 0.05;
        }
    }
}