Multiple Sin Wave (Lissajous)
/**
* 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;
}
}
}