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: Vectorの練習 其の参

なんか、どえらい事になった…

数学勉強しないとっ。
Get Adobe Flash player
by argon 18 Mar 2012
    Embed
/**
 * Copyright argon ( http://wonderfl.net/user/argon )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/537l
 */

// forked from AfroBoy's Vectorの練習 其の参
package 
{
    import flash.display.GraphicsPathCommand;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.geom.Point;
    
    /**
     * ...
     * @author I am Afro Boy ヾ(。`Д´。)ノ
     */
    public class Main extends Sprite 
    {
        private var sp:Sprite;        
        private var commands:Vector.<int>;
        private var data:Vector.<Number>;
        private var r:Number;
        
        public function Main():void 
        {
            if (stage) init();
            else addEventListener(Event.ADDED_TO_STAGE, init);
        }
        
        private function init(e:Event = null):void 
        {
            removeEventListener(Event.ADDED_TO_STAGE, init);
            // entry point
            commands = new Vector.<int>();
            commands.push(GraphicsPathCommand.MOVE_TO);
            data = new Vector.<Number>();
            data.push(0, 0);
            
            var rad:Number = 2 * Math.PI /Math.cos(2);
            
            for (var i:int = 0; i < 700 ; i++) 
            {
                commands.push(GraphicsPathCommand.LINE_TO);// iの値分だけ繰り返す
                r = i * i /500;
                var pt:Point = Point.polar(r, rad * i);
                data.push(pt.x, pt.y);
            }
            
            drawObject();
        }
        
        private function drawObject():void
        {
            sp = new Sprite();
            sp.graphics.lineStyle(1,0x000000);
            sp.graphics.drawPath(commands, data);
            sp.graphics.endFill();
            sp.x = sp.y = 250;
            addChild(sp);
            addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
        }
        
        private function onEnterFrameHandler(e:Event):void 
        {
            sp.rotation += .2;
        }
        
    }
    
}