Sub Process_Globals
Type Action(b As Button, interval As Int, left As Float, top As Float)
Private fx As JFX
Private MainForm As Form
Private csu As CallSubUtils
Private btn(3) As Button
Private ActionList(btn.Length) As List
Private pos(4) As Float = Array As Float(300,200,400,0)
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.Show
csu.Initialize
For i = 0 To btn.Length-1
ActionList(i).Initialize
btn(i).Initialize("btn")
btn(i).Text = i+1
btn(i).Tag = i
MainForm.RootPane.AddNode(btn(i),i*150,0,100,50)
Next
End Sub
Sub btn_Action
Dim b As Button = Sender
If b.Top <> pos(3) Then Return
Dim count As Int = b.Text
ActionList(b.Tag).Add(newaction(b,0,500,pos(0)))
For i = 0 To count-1
ActionList(b.Tag).Add(newaction(b,i,400,pos(1)))
ActionList(b.Tag).Add(newaction(b,i,400,pos(2)))
Next
ActionList(b.Tag).Add(newaction(b,count,500,pos(3)))
animateNow(0, b.Tag)
End Sub
Sub animateNow(animpos As Int, listInt As Int)
Dim act As Action = ActionList(listInt).Get(animpos)
act.b.SetLayoutAnimated(act.interval, act.b.Left, act.top, act.b.Width, act.b.Height)
csu.CallSubPlus2(Me,"checkAnimFin",act.interval,Array(listInt))
End Sub
Sub checkAnimFin(obj() As Object)
Dim listInt As Int = obj(0)
ActionList(listInt).RemoveAt(0)
If ActionList(listInt).Size > 0 Then
animateNow(0,listInt)
End If
End Sub
Sub newaction(myBtn As Button, myid As Int, interval As Int, top As Float) As Action
Dim newact As Action
newact.Initialize
newact.top = top
newact.interval = interval
newact.b = myBtn
Return newact
End Sub