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

flash on 2010-5-13

Get Adobe Flash player
by termat 12 May 2010
    Embed
/**
 * Copyright termat ( http://wonderfl.net/user/termat )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/t2jB
 */

package
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.events.Event;

	[SWF(width="480", height="480", backgroundColor="0x000000", frameRate="30")];
	public class Practice64 extends Sprite {
		private var rings:Array;
		private var rot:Array;
			
		public function Practice64() {
			rings = new Array();
			rot = new Array();
			for (var i:int = 0; i < 200; i=i+20) {
				var r:Ring = new Ring(i + 1, i + 18, getColor(i * 1.8, 1.0), 358);
				r.x = 240, r.y = 240;
				addChild(r);
				rings.push(r);
				var t:Number = 12.0 * Math.random() - 6.0;
				rot.push(t)
			}
			addEventListener(Event.ENTER_FRAME, update);
		}
		
		private function update(e:Event):void {
			for (var i:int = 0; i < rings.length; i++) {
				rings[i].rotation += rot[i];
			}
		}
		
		private function getColor(i:int,s:Number):uint {
			var h:Number = i / 60;
			var ii:Number = Math.floor(h);
			var ff:Number = h - ii;
			switch(ii) {
				case 0:
					return createColor(1.0, 1.0 - s * (1.0 - ff), 1.0 - s);
				case 1:
					return createColor(1.0 - s * ff, 1.0, 1.0 - s);
				case 2:
					return createColor(1.0 - s, 1.0, 1.0 - s * (1.0 - ff));
				case 3:
					return createColor(1.0 - s, 1.0 - s * ff, 1.0);
				case 4:
					return createColor(1.0 - s * (1.0 - ff), 1.0 - s, 1.0);
				default:
					return createColor(1.0, 1.0 - s, 1.0 - s * ff);
			}
		}
	
		private function createColor(rv:Number,gv:Number,bv:Number):uint {
			var rr:int = Math.max(0, Math.min(255, rv * 255));
			var gg:int = Math.max(0, Math.min(255, gv * 255));
			var bb:int = Math.max(0, Math.min(255, bv * 255));
			var color:uint = (rr << 16) + (gg << 8) + bb;
			return color;
		}
	}
}
import flash.display.MovieClip;

class Ring extends MovieClip {
	private var innerRadius:Number;
	private var outerRadius:Number;
	private var color:uint;
	private var maxDeg:Number = 360;
	
	public function Ring(i:Number, o:Number, c:uint,deg:Number=360):void {
		innerRadius = i;
		outerRadius = o;
		color = c;
		maxDeg = deg;
		draw();
	}
	
	private function draw():void {
		var xx:Number, yy:Number, rad:Number;
		graphics.beginFill(color);
		for (var i:Number = 0; i <= maxDeg; i++) {
			rad = i / 180.0 * Math.PI;
			if (i == 0) {
				graphics.moveTo(innerRadius * Math.cos(rad), innerRadius * Math.sin(rad));
				graphics.lineTo(outerRadius * Math.cos(rad), outerRadius * Math.sin(rad));
			}else {
				graphics.lineTo(outerRadius * Math.cos(rad), outerRadius * Math.sin(rad));
			}
		}
		for (i = maxDeg; i >=0; i--) {
			rad = i / 180.0 * Math.PI;
			graphics.lineTo(innerRadius * Math.cos(rad), innerRadius * Math.sin(rad));
		}
		graphics.endFill();
	}
		
}