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

AnimationSample2

see http://gihyo.jp/design/feature/01/frocessing/0003
Get Adobe Flash player
by nutsu 10 Aug 2009
/**
 * Copyright nutsu ( http://wonderfl.net/user/nutsu )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/jufl
 */

// forked from nutsu's AnimationSample 
// forked from nutsu's TransformSample
// see http://gihyo.jp/design/feature/01/frocessing/0003
package {
    import frocessing.display.F5MovieClip2D;
    [SWF(width=465,height=465,backgroundColor=0x000000)]
    public class AnimationSample2 extends F5MovieClip2D
    {
        private var n:int;
        private var r:Number;
        private var a:int;
        
        //描画プログラムの初期化(ADDED_TO_STAGE)
        public function setup():void
        {
            n = 30;
            r = 2*Math.PI/n;
            a = 0;
            colorMode( HSV, n, 1, 1 );
            rectMode( CENTER );
            noStroke();
        }
        
        //一定間隔で描画を実行する(ENTER_FRAME)
        public function draw():void
        {
            //キャンバスをステージの中心へ移動
            translate( 465/2, 465/2 );
            
            //キャンバスを角度a*r回転
            rotate( r * a );
            
            //描画
            for ( var i:int = 0; i < n; i++ ) {
                rotate( r );
                fill( i, 1, 1 );
                rect( 150, 0, 36, 10, 4, 4 );
            }
            a++;
        }
        
        //MOUSE_DOWNイベント時に実行
        public function mousePressed():void
        {
            noLoop();
        }
        
        //MOUSE_UPイベント時に実行
        public function mouseReleased():void
        {
            loop();
        }
    }
}