Private Sub Button1_Click
If PInfo.Visible = True Then
SetLayoutAnimated(PInfo,0, 85dip, 170dip, 223dip, 290dip)
SetLayoutAnimated(PInfo,250, 85dip, 170dip, 3dip, 3dip)
Sleep(250)
PInfo.Visible = False
Else
SetLayoutAnimated(PInfo,0, 85dip, 170dip, 3dip, 3dip)
PInfo.Visible = True
SetLayoutAnimated(PInfo,250, 85dip, 170dip, 223dip, 290dip)
End If
End Sub
Private Sub SetLayoutAnimated(v As B4XView,Duration As Int, Left As Int,Top As Int,Width As Int,Height As Int)
#If B4A
v.SetLayoutAnimated(Duration,Left,Top,v.Width,v.Height)
Dim startTime As Long = DateTime.Now
Dim startHeight As Int = v.Height
Dim deltaHeight As Int = Height - startHeight
Dim startWidth As Int = v.Width
Dim deltaHWidth As Int = Width - startWidth
Dim t As Long = DateTime.Now
Do While t < startTime + Duration
Dim h As Int = startHeight + deltaHeight * (t - startTime) / Duration
Dim w As Int = startWidth + deltaHWidth * (t - startTime) / Duration
v.Height = h
v.Width = w
Sleep(10)
t = DateTime.Now
Loop
v.Height = Height
v.Width = Width
#Else
v.SetLayoutAnimated(Duration,Left,Top,Width,Height)
#End If
End Sub