flash on 2013-11-11

by tepe
♥0 | Line 40 | Modified 2013-12-02 18:10:08 | MIT License
play

ActionScript3 source code

/**
 * Copyright tepe ( http://wonderfl.net/user/tepe )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/aCZq
 */

package {
    import flash.display.*;
    import flash.events.*;
    public class FlashTest extends Sprite {
        private var s:Sprite = new Sprite();
        private var n1:Number = 10;//円の半径
        private var n2:Number = 0;//線の角度
        private var n3:int = 30;//タイマー
        private var n4:Number = 1;
        private var n5:Number = 30;
        private var cnt:int = 0;
        public function FlashTest() {
            // write as3 code here..
            addEventListener(Event.ENTER_FRAME,onEnter);
            graphics.beginFill(0x0);
            graphics.drawRect(0,0,500,500);
            graphics.endFill();
            addChild(s);
            s.x = 100;
            s.y = 100;
            
        }
        
        private function onEnter(e:Event):void{
            s.graphics.clear();
            s.graphics.beginFill(0xffffff,n4);
            s.graphics.drawCircle(0,0,n1);
            
            s.graphics.moveTo(0,0);
            s.graphics.lineStyle(0,0xffffff,n4);
            s.graphics.lineTo(n5*Math.cos(n2),n5*Math.sin(n2));
            s.graphics.moveTo(0,0);
            s.graphics.lineTo(n5*Math.cos(n2+Math.PI),n5*Math.sin(n2+Math.PI));
            n2 += Math.PI *0.005*cnt;
            n1*=1.05;
            n4/=1.2;
            cnt++;
            if(n3<cnt){ 
                removeEventListener(Event.ENTER_FRAME,onEnter);
                removeChild(s);
            }
        }

    }
}