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 3

...
@author Thi
Get Adobe Flash player
by Thy 13 May 2010
/**
 * Copyright Thy ( http://wonderfl.net/user/Thy )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/o1Sw
 */

package 
{
	import flash.display.BlendMode;
	import flash.display.Sprite;
	import flash.display.StageQuality;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.events.TimerEvent;
	import flash.ui.Mouse;
	import flash.utils.Timer;
	
	/**
	 * ...
	 * @author Thi
	 */
	public class Main extends Sprite 
	{
		
		private var fol:Folow, fol2:Folow, fol3:Folow
		
		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);
			stage.frameRate = 0
			stage.quality = StageQuality.LOW
			stage.addEventListener(MouseEvent.MOUSE_MOVE, ativar)
			count = new Timer(3000)
			count.addEventListener(TimerEvent.TIMER, desativar2)
			// entry point
			
			Mouse.hide()
			this.addEventListener(Event.ENTER_FRAME, ef)
			//
			
			fol = new Folow(50)
			fol2 = new Folow(100)
			fol3 = new Folow(100)
			
			fol.R = 5
			fol2.R = 1
			fol3.R = 1
			
			
			addChild(fol)
			addChild(fol2)
			addChild(fol3)
			
			
			fol.blendMode = BlendMode.MULTIPLY
			fol2.blendMode = BlendMode.MULTIPLY
			fol3.blendMode = BlendMode.MULTIPLY
			
		}
		
		private var angulo:Number = 0
		private var raio:Number = 5
		private var raioX:Number = 10
		private var raioY:Number = 12
		// temp variables
		private var X:Number, Y:Number
		private var sen:Number, cos:Number
		
		private function ef(e:Event = null):void
		{
			angulo -= .03490658502 * 5
			
			//
			//raioX = raio * Math.cos(angulo /*+ 1.5707*/ * 2)
			//raioY = raio * Math.sin(angulo)
			
			//
			X = mouseX
			Y = mouseY
			//
			fol.X = X
			fol.Y = Y
			//
			
			sen = Math.sin(angulo)
			cos = Math.cos(angulo)
			
			
			fol2.X = X + raioX * cos
			fol2.Y = Y + raioY * sen
			//fol2.R =  3/(-Math.sin(angulo)+2)
			//
			fol3.X = X - raioX * cos
			fol3.Y = Y - raioY * sen
			//fol3.R =  3/(Math.sin(angulo)+2)
			
			//
			
			
		}
		
		
		
		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;
			//
			ativado = true
			count.reset()
			count.stop()
		}
		
		private var count:Timer
		private var ativado:Boolean
		
		private function desativar(e:Event = null):void
		{
			ativado = false
			count.start()
		}
		
		private function desativar2(e:TimerEvent = null):void
		{
			if (!ativado)
			{
				stage.frameRate = 0
				stage.addEventListener(MouseEvent.MOUSE_MOVE, ativar)
				stage.removeEventListener(Event.MOUSE_LEAVE, desativar)
				stage.quality = StageQuality.LOW
			}
		}
		
		
	}
	
}

//package  
//{
	import flash.display.Graphics;
	import flash.display.Shape;
	import flash.events.Event;
	import flash.filters.GlowFilter;
	/**
	 * ...
	 * @author Thi
	 */
	/*public*/ class Folow extends Shape
	{
		
		public 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
		
		// now there's some customizations.
		public var X:Number = 0, Y:Number = 0
		public var R:Number = 10
		
		private function ef(e:Event = null):void
		{
			g.clear()
			
			p = PARTS[0]
			g.moveTo((p.x += (X - p.x) * .2), (p.y += (Y - p.y) * .2))
			
			
			
			while ((p = p.next) != null)
			{
				g.lineStyle(R/(p.i*.01))
				g.lineTo((p.x += (p.prev.x - p.x) * .8)+.5,(p.y += (p.prev.y - p.y) * .8))
			}
			
			
			
		}
		
		
		
	}

//}


//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
		}
		
	}

//}