Microsoft Small Basic

Program Listing: CRT219
WhiteBrush = "WhiteBrush"
CircularBrush = "CircularBrush"
SunBrush = "SunBrush"
SkyBrush = "SkyBrush"
YellowRaster = "YellowRaster"
RedRaster = "RedRaster"
GreenRaster = "GreenRaster"

FastWindow.WindowSize(800, 600)
FastWindow.WindowBackground (0, 0, 0)

bobCount = 100

For index=1 To bobCount
names[index] = "E_" + index
EndFor

FastWindow.SolidBrush (WhiteBrush, 1, 1, 1, 1)

FastWindow.GradientBrush (YellowRaster, "Clamp", 0, 0, 0, 1)
FastWindow.GradientStop (YellowRaster, 0 , 1, 0, 0, 0)
FastWindow.GradientStop (YellowRaster, 0.5 , 1, 1, 1, 0)
FastWindow.GradientStop (YellowRaster, 1 , 1, 0, 0, 0)

FastWindow.GradientBrush(RedRaster, "Clamp", 0, 0, 0, 1)
FastWindow.GradientStop(RedRaster, 0, 1, 0, 0, 0)
FastWindow.GradientStop(RedRaster, 0.5, 1, 1, 0, 0)
FastWindow.GradientStop(RedRaster, 1, 1, 0, 0, 0)

FastWindow.GradientBrush(GreenRaster, "Clamp", 0, 0, 0, 1)
FastWindow.GradientStop(GreenRaster, 0, 1, 0, 0, 0)
FastWindow.GradientStop(GreenRaster, 0.5, 1, 0, 1, 0)
FastWindow.GradientStop(GreenRaster, 1, 1, 0, 0, 0)

FastWindow.GradientBrush(SkyBrush, "Clamp", 0, 0, 0, 1)
FastWindow.GradientStop (SkyBrush, 0, 0, 13/255, 155/255, 249/255)
FastWindow.GradientStop (SkyBrush, 1, 1, 13/255, 155/255, 249/255)

FastWindow.CircularGradientBrush(CircularBrush, "Clamp", -0.25, -0.25)
FastWindow.GradientStop(CircularBrush, 0, 1, 255/255, 255/255, 255/255)
FastWindow.GradientStop (CircularBrush, 0.58, 1, 0/255, 172/255, 255/255)
FastWindow.GradientStop (CircularBrush, 1, 1, 0/255, 0/255, 0/255)

FastWindow.CircularGradientBrush(SunBrush, "Clamp", 0, 0)
FastWindow.GradientStop(SunBrush, 0, 1, 223 / 255, 255 / 255, 0)
FastWindow.GradientStop(SunBrush, 0.16, 1, 222 / 255, 252 / 255, 0)
FastWindow.GradientStop(SunBrush, 0.46, 1, 244 / 255, 159 / 255, 0)
FastWindow.GradientStop(SunBrush, 1, 0, 203 / 255, 102 / 255, 0)

FastWindow.FilledRectangle ("Sky", SkyBrush, 1, 0,0, 800,600)
FastWindow.FilledEllipse ("SunEllipse", SunBrush, 1, 400, 00, 400, 400)

phase = 0.0

While (Mouse.IsLeftButtonDown = "False")
phase = phase + 0.01
If phase > 12 * 2 * Math.Pi Then
phase = phase - 12 * 2 * Math.Pi
EndIf
current = Clock.ElapsedMilliseconds

FastWindow.FilledRectangle("Raster0", RedRaster, 1, 0, 300 + 100 * Math.Sin(6 * phase + 0.8), 800, 60)
FastWindow.FilledRectangle("Raster1", YellowRaster, 1, 0, 300 + 100 * Math.Sin(6 * phase + 0.4), 800, 60)
FastWindow.FilledRectangle("Raster2", GreenRaster, 1, 0, 300 + 100 * Math.Sin(6 * phase), 800, 60)

For index=1 To bobCount
name = names[index]
offset = index * 2 * Math.PI/(bobCount*2)
degree = phase + offset
scale = 100.0 * (2.0 * bobCount - index) / (2.0 * bobCount)
centerX = scale * (Math.Cos(phase * 3) + 1.5) * Math.Sin(3 * degree) + 300
centerY = scale * (Math.Sin(phase * 4) + 1.5) * Math.Cos(4 * degree)+ 300

FastWindow.FilledEllipse (name, CircularBrush, 1, centerX, centerY, 10, 10)
EndFor

diff = Clock.ElapsedMilliseconds - current
wait = Math.Max (0, 20 - diff)

Program.Delay(wait)
EndWhile