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

not a coincidence

package {
	import flash.display.Sprite;
	import flash.display.BitmapData;
	import flash.geom.Point;
	import flash.geom.Matrix;
	import flash.text.TextField;
	import flash.text.TextFieldAutoSize;
	import flash.text.TextFormat;
	import flash.events.Event;
	[SWF(width="400", height="400", backgroundColor="0xffddff")]
	public class Take01 extends Sprite {
		private const SW:Number = stage.stageWidth;
		private const SH:Number = stage.stageHeight;
		private var dotP:Vector.<Point> = new Vector.<Point>();
		private var dotS:Vector.<Number> = new Vector.<Number>();
		private var dotR:Vector.<Number> = new Vector.<Number>();
		private var dotC:Vector.<uint> = new Vector.<uint>();
		private var ind:int = 180;
		private var pos:Number = 0;
		private const dotRadius:Number = 2;
		private var colors:Array = [0xff0000, 0x0000ff];
		public function Take01():void {
			// 到達位置を決める
			var textformat:TextFormat = new TextFormat();
			textformat.bold = true;
			textformat.font = "Arial Black";
			textformat.size = 80;
			var textfield:TextField = new TextField();
			textfield.defaultTextFormat = textformat;  
			textfield.autoSize = "left"; 
			textfield.text = "wonderfl";
			var bitmapdata:BitmapData = new BitmapData(SW,SH,true,0x000000);
			var matrix:Matrix = new Matrix();
			matrix.translate((SW-textfield.width)/2,(SH-textfield.height)/2);
			bitmapdata.draw(textfield,matrix);
			for (var nY:uint = 0; nY <= SH; nY+=(dotRadius*2)) {
				for (var nX:uint = 0; nX<= SW; nX+=(dotRadius*2)) {
					if (bitmapdata.hitTest(new Point(0,0), 0x00, new Point(nX, nY))) {
						dotS.push(Math.random()*10+10);
						dotR.push(Math.random()*Math.PI*2);
						dotP.push(new Point(nX,nY));
						dotC.push((nX+nY)%2);
					}
				}
			}
			addEventListener(Event.ENTER_FRAME, run);
		}
		private function run(e:Event):void {
			graphics.clear();
			pos = Math.sin((ind/360)*Math.PI)*32;
			dotP.forEach(drawDot);
			ind = ind+3;
		}
		private function drawDot(item:Point, index:int, vector:Vector.<Point>):void {
			var nX:Number = item.x + Math.sin(dotR[index])*(dotS[index] * pos);
			var nY:Number = item.y + Math.cos(dotR[index])*(dotS[index] * pos);
			graphics.beginFill(colors[dotC[index]]);
			graphics.drawCircle(nX,nY,dotRadius);
			graphics.endFill();
		}
	}
}