flash on 2013-6-19

by savage69kr
♥0 | Line 49 | Modified 2013-06-19 22:49:41 | MIT License
play

ActionScript3 source code

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

package {
    import flash.events.MouseEvent;
    import flash.display.Sprite;
    
    import org.libspark.betweenas3.BetweenAS3;
    import org.libspark.betweenas3.tweens.ITween;
    import org.libspark.betweenas3.easing.*;
    
    public class FlashTest extends Sprite {
        private var __shadow:Sprite;
        private var __unit:Sprite;
        
        public function FlashTest() {
            __shadow=new Sprite();
            addChild(__shadow);
            __shadow.graphics.beginFill(0x000000,0.3);
            __shadow.graphics.drawCircle(0,0,50);
            __shadow.x=170;
            __shadow.y=200;
            
            __unit=new Sprite();
            addChild(__unit);
            __unit.graphics.beginFill(0x330099,1);
            __unit.graphics.drawCircle(-1,-1,46);
            __unit.x=170;
            __unit.y=200;
            
            addEventListener(MouseEvent.CLICK,__click);
        }
        private function __click(_e:MouseEvent):void{
            __shadow.x=170;
            __shadow.y=200;
            __unit.x=170;
            __unit.y=200;
            
            var _tx:int=100;
            var _ty:int=50;
            
            var duration:Number=0.8;
            var tween:ITween=
            BetweenAS3.parallel(
                 BetweenAS3.to(__unit,{x:_tx,y:_ty},duration,Quint.easeOut)
                ,BetweenAS3.serial(
                     BetweenAS3.to(__unit,{scaleX:1.4,scaleY:1.4},duration*0.45,Circular.easeOut)
                    ,BetweenAS3.to(__unit,{scaleX:1.0,scaleY:1.0},duration*0.55,Quint.easeOut)
                )
                ,BetweenAS3.to(__shadow,{x:_tx,y:_ty},duration,Quint.easeOut)
                ,BetweenAS3.serial(
                     BetweenAS3.to(__shadow,{scaleX:0.8,scaleY:0.8},duration*0.45,Circular.easeOut)
                    ,BetweenAS3.to(__shadow,{scaleX:1.0,scaleY:1.0},duration*0.55,Quint.easeOut)
                )
            );
            tween.play();
        }
    }
}