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 Susisu 23 Feb 2010
    Embed
/*
 * ランダムで迷走気味なラインアートを描いてくれます
 * なにこれ
 */
package {
	import flash.display.Sprite;
	import flash.text.*;
	import flash.events.Event;
	import flash.events.MouseEvent;
	[SWF(width="465", height="465", backgroundColor="0x000000", frameRate="60")]
	public class color extends Sprite {
		private var r:int,g:int,b:int,a:Number;
		private var xp:Number,yp:Number;
		private var rad:int;
		private var type:Number;
		public function color() {
			r=255;g=0;b=0;
			a=0;
			type=Math.random()*8-4;
			rad=Math.sin(a*type)*Math.cos(a/type)*80+80;
			xp=Math.cos(a)*rad+232;
			yp=Math.sin(a)*rad+232;

			var Button:Sprite=new Sprite();
			var tf:TextField=new TextField();
			tf.text="Restart";
			tf.selectable=false;
			tf.backgroundColor=0x000000;
			tf.textColor=0xFFFFFF;
			tf.background=true;
			tf.border=true;
			tf.x=30;
			tf.y=50;
			tf.autoSize=TextFieldAutoSize.LEFT;
			Button.addChild(tf);
			addChild(Button);
			
			var f:Function;
			Button.addEventListener(MouseEvent.CLICK,f=function(e:MouseEvent):void{
				graphics.clear();
				type=Math.random()*8-4;
				rad=Math.sin(a*type)*Math.cos(a/type)*80+80;
				xp=Math.cos(a)*rad+232;
				yp=Math.sin(a)*rad+232;
			});
			
			addEventListener(Event.ENTER_FRAME,loop);
		}
		private function loop(e:Event):void {
			if(r==255&&g<255&&b==0){g+=2;g=g>255?255:g;}
			if(r>0&&g==255&&b==0){r-=2;r=r<0?0:r;}
			if(r==0&&g==255&&b<255){b+=2;b=b>255?255:b;}
			if(r==0&&g>0&&b==255){g-=2;g=g<0?0:g;}
			if(r<255&&g==0&&b==255){r+=2;r=r>255?255:r;}
			if(r==255&&g==0&&b>0){b-=2;b=b<0?0:b;}
			graphics.lineStyle(1,(r<<16)|(g<<8)|b,100);
			graphics.moveTo(xp,yp);
			xp=Math.cos(a)*rad+232;
			yp=Math.sin(a)*rad+232;
			graphics.lineTo(xp,yp);
			a+=4*Math.PI/180;
			rad=Math.sin(a*type)*Math.cos(a/type)*80+80;
		}
	}
}