Microsoft Small Basic

Program Listing: CDV606
gw = 600
gh = 600
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.BackgroundColor = GraphicsWindow.GetColorFromRGB(200,175,175)

segments = 16
rad = gw/4
cx = gw/2
cy = gh/2

offset = 0
theta1 = 0
x1 = cx+rad*Math.Cos(theta1)
y1 = cy+rad*Math.Sin(theta1)
While ("True")
offset = offset+1
For i = 1 To segments
theta2 = theta1+2*Math.Pi/segments
x2 = cx+rad*Math.Cos(theta2)
y2 = cy+rad*Math.Sin(theta2)
j = Math.Remainder(i+offset,segments)
R = 50+Math.Abs((j/(segments-1)-0.5)*300)
G = R/2
B = R/2
GraphicsWindow.BrushColor = GraphicsWindow.GetColorFromRGB(R,G,B)
GraphicsWindow.FillTriangle(cx,cy,x1,y1,x2,y2)
GraphicsWindow.PenColor = GraphicsWindow.GetColorFromRGB(100,75,75)
GraphicsWindow.DrawLine(cx,cy,x1,y1)
GraphicsWindow.DrawLine(cx,cy,x2,y2)
theta1 = theta2
x1 = x2
y1 = y2
EndFor
Program.Delay(30)
EndWhile