Microsoft Small Basic

Program Listing: MCG292
' Ticker Tape Animation 0.1
' Copyright (c) 2014 Nonki Takahashi.
' 0.1 2014-06-13 Created ()
GraphicsWindow.Title = "Ticker Tape Animation 0.1"
gw = 598
gh = 428
GraphicsWindow.Width = gw
GraphicsWindow.Height = gh
GraphicsWindow.PenWidth = 0
nMin = 1
nMax = 0
AddTickerTape()
Timer.Interval = 1000 / 24
Timer.Tick = OnTick
While "True"
If tick Then
If Math.GetRandomNumber(10) = 1 Then
AddTickerTape()
EndIf
For i = nMin To nMax
x[i] = x[i] + Math.GetRandomNumber(4) - 2
y[i] = y[i] + Math.GetRandomNumber(4)
If y[i] > gh + 60 Then
Shapes.Remove(tt[i])
nMin = i + 1
EndIf
Shapes.Move(tt[i], x[i], y[i])
a[i] = a[i] + 45
If a[i] >= 360 Then
a[i] = a[i] - 360
EndIf
Shapes.Zoom(tt[i], 1, Math.Sin(Math.GetRadians(a[i])))
EndFor
tick = "False"
Else
Program.Delay(1000 / 24)
EndIf
EndWhile
Sub AddTickerTape
nMax = nMax + 1
GraphicsWindow.BrushColor = GraphicsWindow.GetRandomColor()
tt[nMax] = Shapes.AddRectangle(10, 6)
x[nMax] = Math.GetRandomNumber(gw - 20) + 10
y[nMax] = -10
a[nMax] = Math.GetRandomNumber(360) - 1
Shapes.Rotate(tt[nMax], a[nMax])
Shapes.Move(tt[nMax], x[nMax], y[nMax])
EndSub
Sub OnTick
tick = "True"
EndSub