Microsoft Small Basic

Program Listing: WHQ660
'[shape Description], width, height, colour, opacity, move XY, rotate, zoom
'Z-order the shape Description

gws = 500 'a square graphics window
InitGW()
GraphicsWindow.Hide()
InitShapes()
GraphicsWindow.Show()
RevealFace()

subject = Shapes.AddText("Yandee Man")
Shapes.Move(subject, -30, 10)
Shapes.Animate(subject, 400, 10, 2000)
Program.Delay(2020)

dH = 0
incr = 0.5
While "true
dH = dH + incr
dY = dY + incr/2
If dH = F["leftEye"]["HO"] Or dH = 0 Then '30
incr = -incr
EndIf
For i = 6 To 9
z = indices[i]
Shapes.Remove(shp[i])
GraphicsWindow.BrushColor = F[z]["C"]
If i <= 7 Then
shp[i] = Shapes.AddEllipse(F[z]["W"], dH)
Shapes.Rotate(shp[i], F[z]["R"])
Shapes.Move(shp[i], F[z]["X"], F[z]["Y"]+15-dY)
Else
shp[i] = Shapes.AddEllipse(dy, dH) 'dW
Shapes.Move(shp[i], F[z]["X"]+14, F[z]["Y"]+15-dY)
EndIf
EndFor
Program.Delay(20)
EndWhile

Sub InitShapes
F["leftEar"] = "W=20;H=50;C=SpringGreen;Op=0;X=162;Y=120;R=0" '1
F["rightEar"] = "W=20;H=50;C=SpringGreen;Op=0;X=318;Y=120;R=0" '2
F["face"] = "W=150;H=200;C=Green;Op=0;X=175;Y=50;R=0" '3
F["headTopCovr"] = "W=350;H=110;C=black;Op=0;X=75;Y=50;R=0" '4
F["headTop"] = "W=150;H=60;C=Green;Op=0;X=175;Y=129;R=0" '5
F["leftEye"] = "W=40;H=0;HO=30;C=DarkMagenta;Op=0;X=190;Y=145;R=10" '6
F["rightEye"] = "W=40;H=0;HO=30;C=DarkMagenta;Op=0;X=270;Y=145;R=-10" '7
F["leftPupil"] = "W=30;H=0;HO=30;C=Yellow;Op=0;X=190;Y=145;R=0" '8
F["rightPupil"] = "W=30;H=0;HO=30;C=Yellow;Op=0;X=270;Y=145;R=0" '9

indices = Array.GetAllIndices(F) 'index shapes Z-order w/integers

For i = 1 To Array.GetItemCount(F) 'initial setup of shapes - pos & invisible
z = indices[i]
GraphicsWindow.BrushColor = F[z]["C"]
shp[i] = Shapes.AddEllipse(F[z]["W"], F[z]["H"])
Shapes.Move(shp[i], F[z]["X"],F[z]["Y"])
Shapes.Rotate(shp[i], F[z]["R"])
Shapes.SetOpacity(shp[i], 0)
EndFor
EndSub

Sub RevealFace
opacity = 0 '----- reveal all & zoom in to 1
While opacity < 100
opacity = opacity + 0.5
zoom = zoom + 0.005
For i = 1 To Array.GetItemCount(F)
Shapes.SetOpacity(shp[i], opacity)
Shapes.Zoom(shp[i], zoom, zoom)
EndFor
Program.Delay(5)
EndWhile
EndSub

Sub InitGW
GraphicsWindow.Width = gws
GraphicsWindow.Height = gws
GraphicsWindow.PenWidth = 0
GraphicsWindow.BackgroundColor = "black"
GraphicsWindow.Title = "Songline Software"
EndSub