flash on 2009-5-13

by pippo
(・x・)ノ Tweenerの隠しプロパティのテスト
♥0 | Line 37 | Modified 2009-05-13 18:02:57 | MIT License
play

ActionScript3 source code

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

/*
(・x・)ノ Tweenerの隠しプロパティのテスト
*/

package {
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import caurina.transitions.Tweener;
    import caurina.transitions.Equations;
    
    [SWF(width="465", height="465", frameRate="30", backgroundColor="0x000000")]
    
    public class TweenTest extends Sprite {
        
        private var _ball:Ball;
        
        //コンストラクタ
        public function TweenTest() {
            init();            
        }
        
        private function init():void {
            
            //ボール設定
            this._ball = this.addChild(new Ball()) as Ball;
            this._ball.x = stage.stageWidth / 2;
            this._ball.y = stage.stageHeight / 2;
            
            this.stage.addEventListener(MouseEvent.CLICK, onMouseClick);
        }
        
        private function onMouseClick(event:MouseEvent):void {
            Tweener.addTween(this._ball, {
                x: this.mouseX,
                y: this.mouseY,
                time: 0.5,
                transition: Equations.easeOutBack
            });
        }
            
    }
}



import flash.display.Sprite;
import flash.display.Graphics;

class Ball extends Sprite {
    
    public function Ball() {
        var g:Graphics = this.graphics;
        g.beginFill(Math.random() * 0xFFFFFF);
        g.drawCircle(0, 0, 20);
        g.endFill();
    }
}