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

Planets

Get Adobe Flash player
by 178ep3 28 Jul 2009
/**
 * Copyright 178ep3 ( http://wonderfl.net/user/178ep3 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/41QS
 */

package
{
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	
	[SWF(width=465, height=465, frameRate=30, backgroundColor=0x000000)]   
	public class Planets extends Sprite
	{
		private var _list:Array = [];
		private var _max:uint = 1000;
		
		public function Planets()
		{
			var i:int = 0;
			
			for(i=0; i<_max; i++)
			{
				var a:Dot = addChild(new Dot())as Dot;
				_list.push(a);
			}
			
			addEventListener(Event.ENTER_FRAME,upup);
			
			function upup(e:Event):void
			{
				for(i=0; i<_max; i++)
				{
					_list[i].loop();
				}
			}
		}
		
	}
}
	import flash.display.Sprite;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;

class Dot extends Sprite
{
	private var _x:Number;
	private var _y:Number;
	private var _z:Number;
	private var _rad:Number = 200;
	
	private var _xAngle:Number;
	private var _yAngle:Number;
	
	private var _dot:Shape;
		
	public function Dot()
	{
		this.x = 238;
		this.y = 238;
		init();
	}
		
	private function init():void
	{
		_dot = addChild(new Shape())as Shape;
		with(_dot.graphics)
		{
			beginFill(0xffffff);
			drawCircle(0,0,1);
			endFill();
		}
		
		_xAngle = Math.random()/1000;
		_yAngle = Math.random()/1000;
		
		_z = 1;
		_x = _y = 0;
	}
			
	public function loop():void
	{
		var ty:Number = _y*Math.cos(_xAngle)-_z*Math.sin(_xAngle);
		var tz1:Number = _z*Math.cos(_xAngle)+_y*Math.sin(_xAngle);
		var tx:Number = _x*Math.cos(_yAngle)-tz1*Math.sin(_yAngle);
		var tz:Number = _x*Math.sin(_yAngle)+tz1*Math.cos(_yAngle);
		
		_x = tx;
		_y = ty;
		_z = tz;
		
		_dot.x = _x*_rad;
		_dot.y = _y*_rad;
		_dot.scaleX = _dot.scaleY = _z+2;
		_dot.alpha = _z;
		if(_z<0.15)_dot.alpha = 0.15;
		_xAngle += Math.random()/1000-1/2000;
		_yAngle += Math.random()/1000-1/2000;
	}
}