Sub DoAnimation
Dim mOrigPos As Map
mOrigPos.Initialize
For Each v As View In Activity.GetAllViewsRecursive
If v Is Label And v.Tag <> "" Then
mOrigPos.Put(v.Tag, Array As Int (v.Left, v.Top, v.Width, v.Height))
Select Rnd(1,8)
Case 1
'top-left
v.Top = v.Height * -1
v.Left = v.Width * -1
Case 2
'top
v.Top = v.Height * -1
v.Left = (100%x - v.Width) / 2
Case 3
'top-right
v.Top = v.Height * -1
v.Left = 100%x
Case 4
'right
v.Top = (100%y - v.Height) / 2
v.Left = 100%x
Case 5
'bottom-right
v.Top = 100%y
v.Left = 100%x
Case 6
'bottom
v.Top = 100%y
v.Left = (100%x - v.Width) / 2
Case 7
'bottom-left
v.Top = 100%y
v.Left = v.Width * -1
Case 8
'left
v.Top = (100%y - v.Height) / 2
v.Left = v.Width * -1
End Select
End If
Next
Dim pos() As Int
For Each v As View In Activity.GetAllViewsRecursive
If v Is Label And v.Tag <> "" Then
pos = mOrigPos.Get(v.Tag)
v.SetLayoutAnimated(1000, pos(0), pos(1), pos(2), pos(3))
Sleep(0)
End If
Next
Main.onAnim = False
End Sub