ok, i am trying to create a rightward moving sine wave with a fill underneath it, so it looks like a ripple. my problem is for some reason, i can get it to move leftward, but when i try to invert it, i get the bottom right hand corner up in the middle.
here’s my code:
NbrControlPoints = 20;
StartX = 0;
EndX = Stage.width;
BottomY = Stage.height;
WaterLevel = Stage.height/2;
WaveHeight = 30;
WaveSpeed = .0005;
_root.onEnterFrame = function()
{
this.clear();
this.beginFill(0xFE9919, 100);
this.moveTo(StartX, BottomY);
for (x = 0; x < NbrControlPoints; ++x)
{
var r = x/(NbrControlPoints-1);
px = EndX + r*(StartX - EndX);
py = WaterLevel + WaveHeightMath.sin(rMath.PI*2 + getTimer()*WaveSpeed);
this.lineTo(px,py);
}
this.lineTo(StartX, BottomY);
this.lineTo(EndX, BottomY);
this.endFill();
}
and i missing something stupid that is making this happen? i’ve been troubleshooting this for 2 hours and the math is now making my head hurt.
any help would be appriciated.