forked from: mochi

by bradsedito forked from mochi (diff: 50)
♥0 | Line 58 | Modified 2012-03-12 10:55:32 | MIT License
play

ActionScript3 source code

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






package 
{
    import flash.display.*;
    import flash.events.*;
    import flash.geom.*;
    import flash.filters.BlurFilter;
    import com.greensock.*;
    import com.greensock.easing.*;
    import com.greensock.plugins.*;
           TweenPlugin.activate([BlurFilterPlugin]);
    
    
    public class Orb extends Sprite 
    {
        private var _array:Array; //[point]
        private var _blurr:BlurFilter = new BlurFilter( 6,6,3 );
        
        
        public function Orb() 
        {
            _array = new Array();

            for (var index:uint = 0; index < 10; ++index) 
            {
                _array.push(new Point(232, 232));
            }
            
            this.addEventListener(Event.ENTER_FRAME, proc);
        }
        
        private function update():void 
        {
            for (var index:uint = 0; index < _array.length; ++index) 
            {
                var intpRate:Number = 0.9 - (index * 0.03);
                
                TweenMax.to( _array[index],2,
                    {   
                        x:(mouseX * intpRate) + (_array[index].x * (1.0 - intpRate)),
                        y:(mouseY * intpRate) + (_array[index].y * (1.0 - intpRate)),                        
                        ease:Cubic.easeOut
                    });
            }
        }

        private function draw():void 
        {
            var g:Graphics = this.graphics;
            g.clear(); 
            g.beginFill(0x000000);
            g.drawRect(0, 0, 465, 465);
            g.endFill();
            this.filters = [ _blurr ];

            for (var index:uint = 0; index < _array.length; ++index) 
            {
                g.beginFill(0xffffff, 0.2);
                g.drawCircle(_array[index].x, _array[index].y, 50 + (index * 4));
                g.endFill();
            }
        }
        
        private function proc(e:Event):void 
        {
            update();
            draw();
        }
    }
}