'Set the Amplitude and change it based on gh and Ang
amp = Math.Sin(ang)*gh + twist
'Calculate for each row
For y=0 To gh Step sharpness
'Set the coordinates
x1 = Math.Sin(y/amp + ang )*size + set
x2 = Math.Sin(y/amp + ang + 90)*size + set
x3 = Math.Sin(y/amp + ang + 180)*size + set
x4 = Math.Sin(y/amp + ang + 270)*size + set
'Draw each line
If x1
GraphicsWindow.PenColor = "DarkRed"
GraphicsWindow.DrawLine(x1,y x2,y)
EndIf
If x2
GraphicsWindow.PenColor = "Red"
GraphicsWindow.DrawLine(x2,y x3,y)
EndIf
If x3
GraphicsWindow.PenColor = "DarkBlue"
GraphicsWindow.DrawLine(x3,y x4,y)
EndIf
If x4
GraphicsWindow.PenColor = "DarkRed"
GraphicsWindow.DrawLine(x4,y x1,y)
EndIf
EndFor
'Delay before clearing the screen
Program.Delay(delay)
GraphicsWindow.Clear()