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

Multiple Sin Wave (Lissajous)

Get Adobe Flash player
by 883108 03 Mar 2010

    Talk

    883108 at 03 Mar 2010 12:51
    リサジュー曲線と呼ぶらしい。初めて知った。http://ja.wikipedia.org/wiki/%E3%83%AA%E3%82%B5%E3%82%B8%E3%83%A5%E3%83%BC%E5%9B%B3%E5%BD%A2
    Embed
/**
 * Copyright 883108 ( http://wonderfl.net/user/883108 )
 * MIT License ( http://www.opensource.org/licenses/mit-license.php )
 * Downloaded from: http://wonderfl.net/c/irOZ
 */

package{
	import flash.display.Sprite;
	import flash.events.Event;
	
	public class SinWaveMultiDocument extends Sprite{
		private var angleX:Number = 0;
		private var angleY:Number = 0;
		private var centerX:Number = 0;
		private var centerY:Number = 0;
		private var range:Number = 0;
		private var speedX:Number = .31
		private var speedY:Number = .21
		
		public function SinWaveMultiDocument(){
			init();
		}
		
		private function init():void{
			centerX = stage.stageWidth/2;
			centerY = stage.stageHeight/2;
			range = Math.min(stage.stageWidth, stage.stageHeight)/2;
			
			//graphics.beginFill(0xffffff);
			graphics.lineStyle(0, 0xaaaaaa);
			graphics.moveTo(centerX, centerY);
			addEventListener(Event.ENTER_FRAME, onEnterFrame);
		}
		
		private function onEnterFrame($event:Event):void{
			graphics.lineTo(centerX + Math.sin(angleX) * range, centerY + Math.sin(angleY) * range);
			angleX += speedX;
			angleY += speedY;
			
		}
	}
}