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

flash on 2009-11-18

Get Adobe Flash player
by shapevent 18 Nov 2009
    Embed
/**
 * Copyright shapevent ( http://wonderfl.net/user/shapevent )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/fWBR
 */

package {

	import flash.display.*;
	import flash.events.*;


	

       public class Triangles extends MovieClip {
		private var xp:Number;
		private var yp:Number;
		private var r:Number;
		private var t:Number;
		private var speed:Number;
		private var scale:Number;
		private var plot0:Shape;
		private var plot1:Shape;


               public function Triangles(){
                  // init
			x = stage.stageWidth / 2;
			y = stage.stageHeight / 2;
			xp = 0, yp = 0;
			r = 0, t = 0;
			speed = .07;
			scale = 20;
			plot0 = Shape(addChild(new Shape()));
			plot1 = Shape(addChild(new Shape()));
			plot0.graphics.lineStyle(0,0x000000);
			plot1.graphics.lineStyle(0,0x000000);
			addEventListener(Event.ENTER_FRAME, onLoop);
			
			

               }
               // private methods

		private function onLoop(evt:Event):void {
			 r =  scale * Math.sqrt(t);
			 xp =  r * Math.cos(t);
			 yp =  r * Math.sin(t);
			 t += speed;
			plot0.graphics.lineTo(xp, yp);
			plot1.graphics.lineTo(-xp, -yp);
		}
		

       }

}