[ActionScript 3.0] AS3动画类Tweener中滤镜的运用

时间:2023-01-09 22:29:17
package
{
    import caurina.transitions.Tweener;
    import caurina.transitions.properties.FilterShortcuts;
    import caurina.transitions.properties.TextShortcuts;
    
    import flash.display.Sprite;
    import flash.text.TextField;
    
    /**
     * @author: Frost.Yen
     * @E-mail: 871979853@qq.com
     * @create: 2015-6-4 下午2:09:58
     *
     */
    [SWF(frameRate="30",height="768",width="1024")]
    public class TweenerFiltersExample extends Sprite
    {
        private var _test:Sprite;
        private var _text:TextField;
        public function TweenerFiltersExample()
        {
            for(var i:int=0;i<6;i++){
                _test = new Sprite();
                _test.graphics.beginFill(0x00ff00);
                _test.graphics.drawRect(0,0,100,100);
                _test.graphics.endFill();
                _test.x = 100+150*(i%5);
                _test.y = 100+Math.floor(i/5)*150;
                this.addChild(_test);
                FilterShortcuts.init();
            }
            

            Tweener.addTween(this.getChildAt(0),{_Blur_blurX:60,_Blur_blurY:60,time:5,transition:"easeOutCubic"});
            Tweener.addTween(this.getChildAt(1),{_Bevel_blurX:60,_Bevel_blurY:60,time:5,transition:"easeOutCubic"});
            Tweener.addTween(this.getChildAt(2),{_DropShadow_blurX:11,_DropShadow_blurY:11,time:5,transition:"easeOutCubic"});
            Tweener.addTween(this.getChildAt(3),{_Glow_blurX:11,_Glow_blurY:11,time:5,transition:"easeOutCubic"});
            Tweener.addTween(this.getChildAt(4),{_GradientBevel_blurX:60,_GradientBevel_blurY:60,time:5,transition:"easeOutCubic"});
            Tweener.addTween(this.getChildAt(5),{_GradientGlow_blurX:60,_GradientGlow_blurY:60,time:5,transition:"easeOutCubic"});
            
            /**TextField部分属性亦可以用Tweener过度**/
            _text = new TextField();
            _text.autoSize = "left";
            _text.text = "tweener——text——test";
            _text.x = 110+150*(6%5);
            _text.y = 150+Math.floor(6/5)*150;
            this.addChild(_text);
            TextShortcuts.init();
            Tweener.addTween(_text,{_text_size:20,_text_color_r:204,_text_color_g:51,_text_color_b:204,time:1,transition:"easeOutCubic"});
        }
        
        
    }
}