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

Line by mouse 2

...
@author Thi
/**
 * Copyright Thy ( http://wonderfl.net/user/Thy )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/256z
 */

package 
{
	import flash.display.Sprite;
	import flash.display.StageQuality;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.ui.Mouse;
	
	/**
	 * ...
	 * @author Thi
	 */
	public class Main extends Sprite 
	{
		
		public function Main():void 
		{
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void 
		{
			removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
			stage.frameRate = 0
			stage.quality = StageQuality.LOW
			stage.addEventListener(MouseEvent.MOUSE_MOVE, ativar)
			//
			Mouse.hide()
			addChild(new Folow(200))
			//addChild(new Folow())
			
			
		}
		
		private function ativar(e:MouseEvent = null):void
		{
			stage.frameRate = 40
			stage.removeEventListener(MouseEvent.MOUSE_MOVE, ativar)
			stage.addEventListener(Event.MOUSE_LEAVE, desativar)
			stage.quality = StageQuality.BEST;
		}
		
		private function desativar(e:Event = null):void
		{
			stage.frameRate = 0
			stage.addEventListener(MouseEvent.MOUSE_MOVE, ativar)
			stage.removeEventListener(Event.MOUSE_LEAVE, desativar)
			stage.quality = StageQuality.LOW
		}
		
	}
	
}

//package  
//{
	/**
	 * ...
	 * @author Thi
	 */
	/*public*/ class Part
	{
		
		public var x:Number, y:Number
		public var next:Part, prev:Part
		public var i:int
		
		public function Part(x:Number=0,y:Number=0) 
		{
			this.x = x
			this.y = y
		}
		
	}

//}

//package  
//{
	import flash.display.Graphics;
	import flash.display.Shape;
	import flash.events.Event;
	import flash.filters.GlowFilter;
	/**
	 * ...
	 * @author Thi
	 */
	/*public*/ class Folow extends Shape
	{
		
		private var PARTS:Array
		public var num:int
		
		public function Folow(num:int=2) 
		{
			this.num = num
			//
			addEventListener(Event.ADDED_TO_STAGE, added)
			
		}
		
		private function added(e:Event = null):void
		{
			removeEventListener(Event.ADDED_TO_STAGE, added)
			addEventListener(Event.REMOVED_FROM_STAGE, removed)
			//
			init()
			//
			addEventListener(Event.ENTER_FRAME, ef)
		}
		
		private function removed(e:Event = null):void
		{
			removeEventListener(Event.REMOVED_FROM_STAGE, removed)
			addEventListener(Event.ADDED_TO_STAGE, added)
			//
			removeEventListener(Event.ENTER_FRAME, ef)
		}
		
		private var i:int
		
		private function init():void
		{
			PARTS = null
			PARTS = new Array(num)
			
			PARTS[0] = new Part()
			PARTS[0].i = 1
			
			while (++i < num)
			{
				PARTS[i] = new Part()
				PARTS[i].i = i+10
				PARTS[i].prev = PARTS[i-1]
				PARTS[i-1].next = PARTS[i]
			}
			
			g = graphics
			this.filters = [GLOW]
		}
		
		private var GLOW:GlowFilter = new GlowFilter(0xFF8080,1,8,8,2,1)
		
		private var p:Part
		private var g:Graphics
		
		private function ef(e:Event = null):void
		{
			g.clear()
			g.lineStyle(1, 0)
			
			p = PARTS[0]
			g.moveTo((p.x += (mouseX - p.x) * .2), (p.y += (mouseY - p.y) * .2))
			
			
			
			while ((p = p.next) != null)
			{
				g.lineStyle(10/(p.i*.01), 0)
				g.lineTo((p.x += (p.prev.x - p.x) * .8)+1,(p.y += (p.prev.y - p.y) * .8))
			}
			
			
		}
		
		
		
	}

//}