リング2

by freddy forked from マッハの卵、比較 (diff: 24)
♥0 | Line 34 | Modified 2011-11-16 02:46:06 | MIT License
play

ActionScript3 source code

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

// forked from freddy's マッハの卵、比較
// forked from freddy's マッハの卵
package {
    import flash.display.Shape;
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite {
        public function FlashTest() {
            // write as3 code here..
            function createEgg(w:Number, h:Number, m:Number, x:int, y:int, rot:int = 20):Sprite {
                var sp:Sprite = new Sprite();
                sp.graphics.beginFill(0x000000);
                sp.graphics.drawEllipse(-w / 2, -h / 2, w, h);
                w -= m * 2;
                h -= m * 2;
                sp.graphics.drawEllipse(-w / 2, -h / 2, w, h);
                sp.x = x;
                sp.y = y;
                sp.addEventListener(Event.ENTER_FRAME, function (e:Event):void {
                  sp.rotation += rot;  
                });
                return sp;
            }
            this.addChild(createEgg(32.5, 32.5, 3.5, 50, 20));
            this.addChild(createEgg(30, 38, 3.5, 100, 20));
            this.addChild(createEgg(22, 30, 3.5, 100, 70));
            this.addChild(createEgg(14, 22, 3.5, 50, 70));
            
            this.addChild(createEgg(30, 38, 3.5, 50, 120, 0));
            this.addChild(createEgg(22, 30, 3.5, 54, 120, 0));
            this.addChild(createEgg(14, 22, 3.5, 58, 120, 0));
            
            this.addChild(createEgg(30, 38, 3.5, 100, 120, 0));
            this.addChild(createEgg(22, 30, 3.5, 100, 116, 0));
            this.addChild(createEgg(14, 22, 3.5, 100, 112, 0));
            
            this.scaleX = this.scaleY = 3;
        }
    }
}

Forked