Microsoft Small Basic

Program Listing: VHK875
' SmallBasic Version 1.0
' Funktion: BuuhLoween - TextShape Animation
' Autor: Pappa Lapub
' Herkunft:
' ImportURL: http://smallbasic.com/program/?
' Extension:
' Kommentar:
'
' Variablen:
'
' ToDo: Add EasterEgg ' OK : LeftShift + Space (also maybe later; not need to be simult.) changes BGColor
' --------------------------------------------------------------------------------
GW = GraphicsWindow.Width
GH = GraphicsWindow.Height
GraphicsWindow.BackgroundColor = "Black"
Show = "True"

GraphicsWindow.BrushColor = "Red"
buuhSize = 12
buuhShape = Shapes.AddText("")
GraphicsWindow.FontName = "Wingdings"
Skull = Shapes.AddText("")
Blood = Shapes.AddText("")

GraphicsWindow.FontName = "Tahoma"
GraphicsWindow.BrushColor = "Lime"
halloSize = 72
GraphicsWindow.FontSize = HalloSize
halloShape = Shapes.AddText("")

GraphicsWindow.KeyDown = OnKeyDown


While "True"
If Show Then
GraphicsWindow.Title = "Running Animation..."

buuhTxt = "Buuh!"
fSize = buuhSize
twHalf = 0.3 * fSize * Text.GetLength(buuhTxt)
StartX = GW/2 - twHalf
StartY = GH - fSize

Shapes.Move(buuhShape, StartX,StartY)
Program.Delay(1000)
Shapes.SetText(buuhShape, buuhTxt)
dZoom = 1

For Up = 1 To GH/2 + 10
Shapes.Move(buuhShape, StartX,StartY - Up)
If Math.Remainder(Up, 2) = 0 Then
StartX = StartX - 0.2
dZoom = dZoom + 0.1
Shapes.Zoom(buuhShape, dZoom,dZoom)
EndIf
Program.Delay(5)
EndFor

Program.Delay(1000)'
Shapes.Move(Skull, GW/2 - fSize*dZoom, Up + fSize*dZoom - 30)
Shapes.SetText(Skull, "N") ' Wingdings # for skull 0x804E
Shapes.Zoom(Skull, dZoom,dZoom)

Program.Delay(600)
Shapes.Move(Blood, GW/2, Up + fSize*dZoom - 70)
Shapes.SetText(Blood, "S") ' Wingdings # for tear 0x53
Shapes.Zoom(Blood, dZoom,dZoom)

Program.Delay(1000)
halloTxt = "HalloWien"
fSize = halloSize
twHalf = fSize/3.2 * Text.GetLength(halloTxt)

Shapes.SetText(halloShape, halloTxt)
Shapes.Move(halloShape, GW/2 - twHalf,(Shapes.GetTop(buuhShape) - 60 - fSize)/2)

For dX = 0.1 To 1 Step 0.01
Shapes.Zoom(halloShape, dX,1)
Program.Delay(40)
EndFor

Show = ""
GraphicsWindow.Title = "Ready. Press any key but 'Escape' to repeat"

Else
Program.Delay(100)
EndIf
EndWhile


' ////////// EVENTs \\\\\\\\\\
Sub OnKeyDown
If GraphicsWindow.LastKey = "LeftShift" Then
ShftFlag = "True"
EndIf
If GraphicsWindow.LastKey = "Space" And ShftFlag Then
ShftFlag = ""
EasterEgg()
EndIf

If GraphicsWindow.LastKey = "Escape" Then
Program.End()
Else

If Show = "" Then
Show = "True"
Shapes.SetText(buuhShape,"")
Shapes.SetText(Blood,"")
Shapes.SetText(Skull,"")
Shapes.SetText(halloShape,"")
EndIf

EndIf
EndSub

' ////////// SUBs \\\\\\\\\\
Sub EasterEgg
GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor()
EndSub