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

code on 2008-12-18

Get Adobe Flash player
by wildcard 18 Dec 2008
    Embed
package {
	import flash.events.Event;	
	import flash.display.Sprite;	

	public class LineA extends Sprite {
		private var max : int = 40;
		private var prex : Number = mouseX;
		private var prey : Number = mouseY;
		private var pAry : Array = new Array();
		[SWF(width="465", height="465", backgroundColor="0xFFFFFF", frameRate="30")]  
		//
		function LineA() {
			for (var i1 :int= 0;i1 < max; i1++) {
				pAry[i1] = {x:mouseX, y:0, vx:0, vy:0};
			}
			addEventListener(Event.ENTER_FRAME, draw);
		}
		private function draw(e : Event) :void{
			//mouse
			var vx:Number = mouseX - prex;
			var vy:Number = mouseY - prey;
			prex = mouseX;
			prey = mouseY;
			//adj point
			if (Math.abs(vx) + Math.abs(vy) > 30) {
				var o : Object = {x:mouseX, y:mouseY, vx:vx * 0.1, vy:vy * 0.1};
				pAry.push(o);
				pAry.shift();
			}
			//draw    
			graphics.clear();
			graphics.moveTo(mouseX, mouseY);
			var l:int = pAry.length - 1;
			for (var i1 :int= l;i1 > 0; i1--) {
				graphics.lineStyle( (max - i1) * 0.7 + 1, 0x333333, 100, true, "none", "square", "round", 1);
				var pt : Object = pAry[i1];
				pt.vx *= (1.001 + Math.abs(vx * 0.001));
				pt.vy *= (1.001 + Math.abs(vy * 0.001));
				pt.x += pt.vx;
				pt.y += pt.vy;
				if (i1 - 1) {
					graphics.curveTo(pt.x, pt.y, (pt.x + pAry[i1 - 1].x) / 2, (pt.y + pAry[i1 - 1].y) / 2);
				}
			}
		}
	}
}