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

forked from: forked from: マウスから逃げる

--
元気玉
----
// forked from s26's forked from: マウスから逃げる
// forked from sake's マウスから逃げる
/*--
元気玉
----*/

package
{
    import flash.display.BlendMode;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.filters.BlurFilter;
    import caurina.transitions.*;
    import caurina.transitions.properties.FilterShortcuts;
    [SWF(width="465", height="465", backgroundColor="0x000000", frameRate="40")]

    public class RunAwayFromMouse extends Sprite
    {
        

        private var _mask:Sprite
        private var _base:Sprite
        
        public function RunAwayFromMouse(){
            FilterShortcuts.init()
            stage.frameRate = 60
            _mask = new Sprite();
            _mask.graphics.beginFill(0xffffff,1);
            _mask.graphics.drawCircle(stage.stageWidth/2,stage.stageHeight/2,100);
            _mask.graphics.endFill();
            _base = new Sprite();
            _base.graphics.beginFill(0x000000,1);
            
            addChild(_mask);
            addChild(_base);
            _base.mask = _mask
            _base.cacheAsBitmap = true
            _mask.cacheAsBitmap = true
            Tweener.addTween(_base,{_Blur_blurX:20,_Blur_blurY:20,_Blur_quality:1})
            addEventListener(Event.ENTER_FRAME, onFrame);
        }


        public function onFrame(e:Event):void{
               if(Math.random()*2<1){
                var circle:Shape=new Shape();
                circle.graphics.beginFill(0xe4846e,0.4+0.5*Math.random());
                circle.graphics.drawCircle(0, 0, 38 );
                circle.graphics.endFill();
                circle.blendMode=BlendMode.ADD;
                circle.x=Math.round(Math.random() * (stage.stageWidth-200)+100);
                circle.y=Math.round(Math.random() *(stage.stageHeight-200)+100);
                circle.filters=[new BlurFilter(10, 20*Math.random(), 1)];
                _base.addChild(circle);
                Tweener.addTween(circle,{alpha:0});
                Tweener.addTween(circle,{alpha:1,transition:"linear",time:0.7,onComplete:function(){
                    Tweener.addTween(circle,{alpha:0,transition:"linear",time:0.2,onComplete:function(){
                        removeChild(circle)
                    }})

                }});
               }            
        }
    }
}