?
This code is wrong?
This code is wrong?
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim b As Button
Dim p As Panel
Dim ani As Animation
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
p.Initialize("panel11")
b.Initialize("btn11")
Activity.AddView(p,65%x,12%y,34%x,80%y)
Activity.AddView(b,10%x,10%y,30%x,20%y)
ToastMessageShow(Activity.Width,False)
p.Color = Colors.Blue
b.Color = Colors.Red
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btn11_Click
' ani.InitializeTranslate("ani1",65%x,100%y,65%x,12%y)
If p.Top = 12%y Then
ani.InitializeTranslate("ani1",0,12%y,0,100%y)
ani.Duration = 1000
ani.Start(p)
Else
ani.InitializeTranslate("ani2",0,100%y,0,12%y)
ani.Duration = 1000
ani.Start(p)
ToastMessageShow("if result is : No",False)
End If
End Sub
Sub ani1_AnimationEnd
p.Top = 100%y
ToastMessageShow("End animation 1",False)
End Sub
Sub ani2_AnimationEnd
p.Top = 12%y
ToastMessageShow("End animation 2",False)
End Sub
Attachments
Last edited: