Android Question 360 in 10 seconds

Erel

B4X founder
Staff member
Licensed User
Longtime User
B4X:
Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private ImageView1 As B4XView
    Private bc As BitmapCreator
    Private xui As XUI
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("1") 'Load the layout file.
    MainForm.Show
    bc.Initialize(ImageView1.Width, ImageView1.Height)
    DrawCircleIn10Seconds
End Sub

Sub DrawCircleIn10Seconds
    Dim Start As Long = DateTime.Now
    Dim Duration As Int = 10 * DateTime.TicksPerSecond
    Dim Progress As Float
    Dim Brush As BCBrush = bc.CreateBrushFromColor(xui.Color_Blue)
    Dim Transparent As BCBrush = bc.CreateBrushFromColor(xui.Color_Transparent)
    Do While DateTime.Now < Start + Duration + 30
        Progress = Min(1, (DateTime.Now - Start) / Duration)
        bc.DrawRect2(bc.TargetRect, Transparent, True, 0)
        bc.DrawArc2(bc.TargetRect.Width / 2, bc.TargetRect.Height / 2, 100dip, Brush, False, 4dip, 0, Progress * 360)
        bc.SetBitmapToImageView(bc.Bitmap, ImageView1)
        Sleep(16)
    Loop
End Sub
 
Upvote 0
Top