toggleGW = -1 'toggles on start. ------ Initialise for InitGW()
bY = 0.1 'opn=1 , close=0.1 ------- Initialise for Blink()
bX = 0.8 'opn=0.2, close=0.8
delta = 0.01
flag = "toggleGW"
'==========================Event Loop========================
While "true
If flag = "toggleGW" Then
InitGW()
RemoveFace()
InitFace() 'includes RefreshButton() -adds on top
RevealFace()
flag = "blink"
ElseIf flag = "blink" Then
Blink()
EndIf
Program.Delay(5)
EndWhile
'--------------------------------------------Subroutines-----------------------------------------
Sub Blink
If bY = 1 Then
delta = -delta
Timer.Resume()
flag = 0
ElseIf bY = 0.1 Then
delta = -delta
EndIf
bY = bY - delta
bX = bX + (delta*0.7)
For i = 6 To 7
Shapes.Zoom(shp[i], 1, bY)
Shapes.Zoom(shp[i+2], bX, bY)
EndFor
EndSub
Sub RevealFace
zoom = 0
opacity = 0 '----- reveal all & zoom in to 1
While opacity < 100
opacity = opacity + 4
zoom = zoom + 0.04
For i = 1 To Array.GetItemCount(F)
Shapes.SetOpacity(shp[i], opacity)
Shapes.Zoom(shp[i], zoom, zoom)
EndFor
Program.Delay(1)
EndWhile
EndSub
Sub InitFace
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]
If gwSize = 2 And z = "headTopCovr" Then
GraphicsWindow.BrushColor = GW["small"][1]["BGC"]
Else
GraphicsWindow.BrushColor = F[z]["C"]
EndIf
shp[i] = Shapes.AddEllipse(F[z]["W"], F[z]["H"])
Shapes.Move(shp[i], F[z]["X"]+offSetX,F[z]["Y"]+offSetY)
Shapes.Rotate(shp[i], F[z]["R"])
Shapes.SetOpacity(shp[i], 0) '0
EndFor
RefreshButton()
EndSub
Sub RemoveFace
For i = 1 To Array.GetItemCount(F)
Shapes.Remove(shp[i])
EndFor
EndSub
'-----------------------------------------2nd Level Subroutine--------------------------------
Sub RefreshButton
indices = Array.GetAllIndices(GW) 'returns--> 1=big;2=small
i = indices[gwSize]