Private Sub AnimateBorder(View As View)
Dim n As Long = DateTime.Now
Dim duration As Int = 500
Dim start As Float = 0
Dim tempValue As Float
Dim cvs As Canvas
cvs.Initialize(View)
cvs.DrawColor(Colors.Transparent)
Do While DateTime.Now < n + duration
tempValue = ValueFromTimeLinear(DateTime.Now - n, start, 100 - start, duration)
DrawValue(View, cvs, tempValue)
Sleep(10)
Loop
DrawValue(View, cvs, 100)
End Sub
Private Sub DrawValue(View As View, cvs As Canvas, Value As Float)
Dim clr As Int = Colors.White
Dim strokewidth As Int = 4dip
Dim cx = View.Width / 2 As Float
Dim width As Float = View.Width / 50 * Min(50, Value)
cvs.DrawLine(cx - width / 2, 0, cx + width / 2, 0, clr, strokewidth)
cvs.DrawLine(cx - width / 2, View.Height, cx + width / 2, View.Height, clr, strokewidth)
If Value > 50 Then
Dim height As Float = View.Height / 50 * (Value - 50)
cvs.DrawLine(0, 0, 0, height / 2, clr, strokewidth)
cvs.DrawLine(0, View.Height, 0, View.Height - height / 2, clr, strokewidth)
cvs.DrawLine(View.Width, 0, View.Width, height / 2, clr, strokewidth)
cvs.DrawLine(View.Width, View.Height, View.Width, View.Height - height / 2, clr, strokewidth)
End If
View.Invalidate
End Sub