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

はえ

Get Adobe Flash player
by yanbaka 07 May 2009
    Embed
package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	[SWF(width = "465", height = "465", backgroundColor = "0xFFFFFF", frameRate = "30")]
	public class Fly extends Sprite
	{
		private var num:uint = 300;
		private var maxRad:Number = 50;
		private var friction:Number = 0.95;
		private var dots:Array = [];
		
		public function Fly()
		{
			for(var i:uint=0 ;i<num; i++)
			{
				var dot:Ball = new Ball(1, 0);
				var radius:Number = Math.sqrt(Math.random())*maxRad;
				var angle:Number = Math.random()*(Math.PI*2);
				dot.x = stage.stageWidth / 2 + Math.cos(angle)*radius;
				dot.y = stage.stageHeight/2 + Math.sin(angle)*radius;
				addChild(dot);
				dots.push(dot);
			}
			
			addEventListener(Event.ENTER_FRAME, loop);
		}
		
		private function loop(e:Event):void
		{
			for (var i:uint=0; i<num; i++)
			{
				var dot:Ball = dots[i];
				dot.vx += Math.random()*0.2-0.1;
				dot.vy += Math.random()*0.2-0.1;
				var radius:Number = Math.sqrt(Math.random())*maxRad;
				dot.x += (mouseX - dot.x)/3 + dot.vx * radius;
				dot.y += (mouseY - dot.y)/3 + dot.vy * radius;
				dot.vx *= friction;
				dot.vy *= friction;
			}
		}
	}
}

	import flash.display.Sprite;
	import flash.display.Shape;

	class Ball extends Shape
	{
		public var radius:Number;
		public var color:uint;
		public var vx:Number=0;
		public var vy:Number = 0;
		
		public function Ball(radius:Number=40, color:uint=0xFF0000)
		{
			this.radius = radius;
			this.color = color;
			
			graphics.beginFill(color);
			graphics.drawCircle(0, 0, radius);
			graphics.endFill();
		}
	}