Microsoft Small Basic

Program Listing: JRV115
' Illumination Sample
' Copyright © 2015 Nonki Takahashi. The MIT License.
' Last Update 2015-12-07
'
GraphicsWindow.Title = "Illumination Sample"
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.BackgroundColor = "Black"
GraphicsWindow.FontName = "Impact"
GraphicsWindow.FontBold = "False"
GraphicsWindow.FontSize = 220
GraphicsWindow.BrushColor = "#000001"
xYear = 76
yYear = 76
GraphicsWindow.DrawText(xYear, yYear, "2016")
seq = "1=40;2=60;3=80;4=100;5=80;6=60;"
MAXCOUNT = 6
MAXROW = 24
MAXCOL = 60
size = 4
i = 1
gap = 8
x = (gw - size) / 2
y = (gh - size) / 2
y = (gh - gap * (MAXROW - 1)) / 2
GraphicsWindow.BrushColor = "Blue"
GraphicsWindow.PenWidth = 0
For row = 1 To MAXROW
x = (gw - gap * (MAXCOL - 1)) / 2
For col = 1 To MAXCOL
color = GraphicsWindow.GetPixel(x, y)
If color = "#000001" Or color = "#FF000001" Then
iMax = i
lamp[i] = Shapes.AddEllipse(size, size)
Shapes.Move(lamp[i], x - size / 2, y - size / 2)
count[i] = Math.GetRandomNumber(MAXCOUNT)
Shapes.SetOpacity(lamp[i], seq[count[i]])
i = i + 1
EndIf
x = x + gap
EndFor
y = y + gap
EndFor
GraphicsWindow.FontSize = 20
GraphicsWindow.FontName = "Trebuchet MS"
GraphicsWindow.BrushColor = "#999999"
msg = Shapes.AddText("HAPPY HOLYDAYS And Have a Great")
countMsg = MAXCOUNT
Shapes.SetOpacity(msg, seq[countMsg])
Shapes.Move(msg, xYear, yYear)
While "True"
For j = 1 To 500
i = Math.GetRandomNumber(iMax)
count[i] = count[i] - 1
If count[i] = 0 Then
count[i] = MAXCOUNT
EndIf
Shapes.SetOpacity(lamp[i], seq[count[i]])
EndFor
countMsg = countMsg - 1
If countMsg = 0 Then
countMsg = MAXCOUNT
EndIf
Shapes.SetOpacity(msg, seq[countMsg])
Program.Delay(1)
EndWhile