This makes your wait times all silly and wavy.
Simba Code:
procedure SineWait(const min, max: Int32);
const
R1 = 0.15; //range of the small waves
R2 = 0.85; //range of the large waves (Note: R1 + R1 = 1.0
P1 = 4.00; //period of the small waves in minutes
P2 = 60.0; //period of the large waves in minutes
var
t, r: Extended;
begin
if (max <= min) then Exit;
if ((R1 + R2) <> 1.0) then Exit;
t := (GetTimeRunning() / 60000);
r := ((max - min) / 2);
Wait(Round(R1 * r * Sin(2 * PI * t / P1) + R2 * r * Sin(2 * PI * t / P2) + min + r));
end;
With the above settings, your wait times will look like this over the course of an hour.
Here's a little program to help visualize what final result will look like, where each pixel of width is 6 seconds.
Simba Code:
program sinewait_demo;
function SineWaitDemo(const min, max, x: Int32): Int32;
const
R1 = 0.15; //range of the small waves
R2 = 0.85; //range of the large waves (Note: R1 + R1 must be 1.0
P1 = 4.00; //period of the small waves in minutes
P2 = 60.0; //period of the large waves in minutes
var
t, r: Extended;
begin
if (max <= min) then Exit;
if ((R1 + R2) <> 1.0) then Exit;
t := (x / 10);
r := ((max - min) / 2);
Result := Round(R1 * r * Sin(2 * PI * t / P1) + R2 * r * Sin(2 * PI * t / P2) + min + r);
end;
procedure Demo();
const
W = 600;
H = 300;
var
bmp, x, y: Int32;
begin
bmp := CreateBitmap(W, H);
try
for x := 0 to W-1 do
begin
y := SineWaitDemo(0, H-1, x);
FastSetPixel(bmp, x, H-1 - y, $FFFFFF);
end;
ClearDebugImg();
DisplayDebugImgWindow(W, H);
DrawBitmapDebugImg(bmp);
finally
FreeBitmap(bmp);
end;
end;
begin
ClearDebug;
Demo();
end.