Microsoft Small Basic

Program Listing: ZSW822
'Animate GW.Title back and forth.
'by Jibba Jabba, January 2014 Challenge
'it's in a Timer thread because i'm using for another program
' that will be doing Asycronous b/ground network stuff

title = "Happy New Year"
titleRight = 120
incrementLeft = 1
waitForOtherThread = "True"

For i = 1 To titleRight 'create Array in Main thread. Init
titleLeft[i] = Text.Append(titleLeft[i-1]," ")
EndFor

Timer.Tick = CreateTitleAnimation
Timer.Interval = 100

While waitForOtherThread
Program.Delay(50)
EndWhile

Sub CreateTitleAnimation '2nd Thread
Timer.Pause()
waitForOtherThread = "False"

While "True"
leftIndex = leftIndex + incrementLeft
If leftIndex = 0 Or leftIndex = titleRight Then
incrementLeft = -incrementLeft
EndIf

GraphicsWindow.Title = titleLeft[leftIndex] + title
Program.Delay(30)
EndWhile

EndSub