forked from: flash on 2009-10-19

by takabo1212
♥0 | Line 30 | Modified 2009-11-05 07:39:04 | MIT License
play

ActionScript3 source code

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

// forked from yaneura9's flash on 2009-10-19
package{
    import flash.display.Sprite;
    import flash.events.MouseEvent;
    import caurina.transitions.Tweener;

    public class Anime2 extends Sprite{
        public function Anime2():void{
            // クリックイベントを監視する
            stage.addEventListener("click", clickHandler);
        }

        private function clickHandler(event:MouseEvent):void {
            // 円を作成
            var s:Sprite = new Sprite();
            s.graphics.beginFill(Math.random() * 0x1000000);
            s.graphics.drawCircle(0, 0, 10);
            s.graphics.endFill();
            s.alpha = 0.5;
            addChild(s);

            // 円をクリックされた位置に移動
            s.x = event.stageX;
            s.y = event.stageY;
            s.scaleX = s.scaleY = 0;

            Tweener.addTween(s, {
                time: 0.5,    // 1秒間のアニメーション
                scaleX: 5,  // s の scaleX を 5 まで遷移
                scaleY: 5   // s の scaleY を 5 まで遷移
            });
	       Tweener.addTween(s, {
		     time: 10,
	         alpha: 0
			     });
        }
    }
}

Forked