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

rotationの練習

PS2のゲーム「ペルソナ4」のローディング?画面が見ていて楽しかったので回転の練習と題して似た動きをSpriteで作ってみました。
Get Adobe Flash player
by yuugurenote 19 Nov 2011
    Embed
/**
 * Copyright yuugurenote ( http://wonderfl.net/user/yuugurenote )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/6jBU
 */

package {
    import flash.display.Sprite;
    import flash.events.Event;
    [SWF(width=465,height=465,frameRate=60)]

    public class AS111119_01 extends Sprite {
        public var sw:Number=stage.stageWidth;
        public var sh:Number=stage.stageHeight;
        public var _mySprite:mySprite;
        public var _mySprite2:mySprite2;
        public var _mySp:Sprite = new Sprite();
        public var _mySp2:Sprite = new Sprite();
        public var _myColor:Array=["0x00FF00","0xFFFF00","0xFF0000"];

        public function AS111119_01() {
            this.graphics.beginFill(0x000000,1);
            this.graphics.drawRect(0,0,sw,sh);
            this.graphics.endFill();

            _mySp2.x=380;
            _mySp2.y=425;
            _mySp2.rotationX = 90;
            addChild(_mySp2);

            _mySp.x=_mySp.y=380;
            addChild(_mySp);

            _mySprite = new mySprite();
            _mySp.addChild(_mySprite);

            for (var i:uint=0; i<3; i++) {
                _mySprite2=new mySprite2(_myColor[i],i*120);
                _mySp2.addChild(_mySprite2);
            }
            addEventListener(Event.ENTER_FRAME, xEnter);
        }
        private function xEnter(e:Event):void {
            _mySp.rotationY+=3;
            _mySp2.rotationY+=3;
        }
    }
}

import flash.display.Sprite;
class mySprite extends Sprite {
    public function mySprite() {
        this.graphics.beginFill(0xFFFFFF,1);
        this.graphics.drawRect(0,0,25,37);
        this.graphics.endFill();
        this.rotation=30;
    }
}
class mySprite2 extends Sprite {
    public function mySprite2(myColor:uint,myRot:uint) {
        this.graphics.beginFill(myColor,1);
        this.graphics.drawRect(0,0,15,20);
        this.graphics.endFill();
        this.rotation=myRot;
    }
}