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

GURU GURU

Get Adobe Flash player
by sakusan393 24 Jun 2011
    Embed
/**
 * Copyright sakusan393 ( http://wonderfl.net/user/sakusan393 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/AdkO
 */

package  {
    
    import flash.display.*;
    import flash.events.*;
    
    public class GuruGuru extends Sprite {
        
        private var _w:int = 465;
        private var _h:int = 465;
        private var _wall0:Sprite,_wall1:Sprite;
        private var _count:Number = Number.MIN_VALUE;
        private var _speedCount:Number = Number.MIN_VALUE;
        private var _speed:Number = 0;
                
        public function GuruGuru():void {
            _wall0 = new Sprite();
            _wall1 = new Sprite();
            changeWall(_wall0,_w*2,Math.random()*0xFFFFFF);
            changeWall(_wall1,_w*2,Math.random()*0xFFFFFF);
            
            addChild(_wall0);
            addChild(_wall1);
            
            addEventListener(Event.ENTER_FRAME, enterFrameHandler);
        }
        private function enterFrameHandler(e:Event):void {
            _speedCount += 0.01;
            _speed = Math.sin(_speedCount) * 0.5;
            _count += _speed;
            
            _wall0.x = Math.sin(_count) * 2 + _w / 2;
            _wall1.x = Math.sin(_count + Math.PI) * 2 + _w / 2;
            
            _wall0.y = Math.cos(_count) * 2 + _h / 2;
            _wall1.y = Math.cos(_count + Math.PI) * 2 + _h / 2;
        }
        
        private function changeWall(sp:Sprite ,count:int, color:int = 0 ):void {
            var length:int = count / 2 / 4;
            for (var i:int = 0; i < length; i++) {    
                sp.graphics.lineStyle(2, color, i/length);
                sp.graphics.drawCircle(0,0,i*4);
            }
            sp.graphics.endFill();
        }
    }
}