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

CircloidRandom

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

// forked from fakestar0826's Brown
// forked from fakestar0826's flash on 2011-2-24
package {
    import flash.events.Event;
    import flash.display.Sprite;
    public class FlashTest extends Sprite 
    {
        private var numDots:int = 1000;
        private var friction:Number = 0.95;
        private var dots:Array;
        private var maxRadius:Number = 50;
        public function FlashTest() 
        {
            graphics.lineStyle(0, 0, 0.5);
            dots = [];
            for(var i:int = 0;i < numDots;i++)
            {
                var d:Ball = new Ball(1);
                //var r:Number = Math.random() * maxRadius;
                var r:Number = Math.sqrt(Math.random()) * maxRadius;
                var a:Number = Math.random() * (Math.PI * 2);
                d.x = stage.stageWidth / 2 + Math.cos(a) * r;
                d.y = stage.stageHeight / 2 + Math.sin(a) * r;
                d.vx = 0;
                d.vy = 0;
                addChild(d);
                dots[i] = d;
            }

            addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }
        
        private function onEnterFrame(e:Event):void
        {
            for(var i:int = 0;i < numDots;i++)
            {
                var d:Ball = dots[i];
                
                d.vx += Math.random() * 0.2 - 0.1;
                d.vy += Math.random() * 0.2 - 0.1;
                d.x += d.vx;
                d.y += d.vy;
                d.vx *= friction;
                d.vy *= friction;
                
                if(d.x > stage.stageWidth)
                {
                    d.x = 0;
                }
                else if(d.x < 0)
                {
                    d.x = stage.stageWidth;
                }
                
                if(d.y > stage.stageHeight)
                {
                    d.y = 0;
                }
                else if(d.y < 0)
                {
                    d.y = stage.stageHeight;
                }
            }
        }

    }
}
import flash.display.Sprite;

class Ball extends Sprite
{
    public var vx:Number = 0;
    public var vy:Number = 0;
    public function Ball(r:Number = 10)
    {
        graphics.beginFill(0xFF0000);
        graphics.drawCircle(0, 0, r);
        graphics.endFill();
    }

}