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

forked from: Group Velocity

...
@author k_tsushima
Imitation of http://homepage3.nifty.com/iromono/kougi/qm/vpvg3.html
Get Adobe Flash player
by taka_milk 16 Nov 2009
/**
 * Copyright taka_milk ( http://wonderfl.net/user/taka_milk )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/534i
 */

// forked from k_tsushima's Group Velocity
package 
{
	import flash.display.*;
    import flash.events.*;
	/**
	 * ...
	 * @author k_tsushima
	 *Imitation of http://homepage3.nifty.com/iromono/kougi/qm/vpvg3.html
	 */
	[SWF(backgroundColor="0xffffff")]
	public class sin_curve extends Sprite
	{
		public function sin_curve():void {
			if (stage) init();
			else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private var s1:Sprite = new Sprite();
		private var s2:Sprite = new Sprite();
		private var s12:Sprite = new Sprite();
		private var s12b:Sprite = new Sprite();
		private var t:uint = 0;
		
		private function init(e:Event = null):void {
            stage.quality = "high";
			stage.scaleMode = StageScaleMode.NO_SCALE;
            stage.align = StageAlign.TOP_LEFT;
			stage.addChild(s1);
			stage.addChild(s2);
			stage.addChild(s12);
			stage.addChild(s12b);
			stage.addEventListener(Event.ENTER_FRAME, drawSin);
			
		}
		
		private function drawSin(e:Event = null):void {
			if (t > 0) {
				s1.graphics.clear();
				s2.graphics.clear();
				s12.graphics.clear();
				s12b.graphics.clear();
			}
			var w:Number = stage.stageWidth;
			var h:Number = stage.stageHeight;
			var rad:Number = 2 * Math.PI / 180;
			var k1:Number = 4 * rad; 
			var k2:Number = 4.4 * rad;
			var omega1:Number = 2 * t * rad; 
			var omega2:Number = 2 * t * rad* 2;
			s1.graphics.lineStyle(1, 0x0000ff);
			s1.graphics.moveTo(0, h / 2-h/8*Math.sin(-omega1));
			s2.graphics.lineStyle(1, 0x000000);
			s2.graphics.moveTo(0, h / 2-h/8*Math.sin(-omega2));
			s12.graphics.lineStyle(2, 0xff0000);
			s12.graphics.moveTo(0, h / 2-h/8*Math.sin(-omega1)-h/8*Math.sin(-omega2));
			s12b.graphics.lineStyle(3, 0x00ff00);
			s12b.graphics.moveTo(0, h / 2-h/4*Math.cos(-(omega1-omega2)/2));
			for (var i:uint = 1; i < w; i++) { 
				var y1:Number = h / 8 * Math.sin(k1 * i - omega1);
				var y2:Number = h / 8 * Math.sin(k2 * i - omega2);
				s1.graphics.lineTo(i, h/2-y1);
				s2.graphics.lineTo(i, h/2-y2);
				s12.graphics.lineTo(i,h/2-(y1+y2));
				s12b.graphics.lineTo(i,h/2-h/4*Math.cos(((k1-k2)*i-(omega1-omega2))/2));
			}
			t++;
		}
	}
	
}