#Region Project Attributes
#ApplicationLabel: B4A Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: True
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Private xui As XUI
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
Private Button1 As B4XView
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("Layout")
CreateHaloEffect(Button1, 5%x, 10%y,xui.Color_Red)
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Button1_Click
xui.MsgboxAsync("Hello world!", "B4X")
End Sub
Sub CreateHaloEffect (Parent As B4XView, x As Int, y As Int, clr As Int)
Dim cvs As B4XCanvas
Dim p As B4XView = xui.CreatePanel("")
Dim radius As Int = 150dip
p.SetLayoutAnimated(0, 0, 0, radius * 2, radius * 2)
cvs.Initialize(p)
cvs.DrawCircle(cvs.TargetRect.CenterX, cvs.TargetRect.CenterY, cvs.TargetRect.Width / 2, clr, True, 0)
Dim bmp As B4XBitmap = cvs.CreateBitmap
For i = 1 To 5
CreateHaloEffectHelper(Parent,bmp, x, y, clr, radius)
Sleep(800)
Next
End Sub
Sub CreateHaloEffectHelper (Parent As B4XView,bmp As B4XBitmap, x As Int, y As Int, clr As Int, radius As Int)
Dim iv As ImageView
iv.Initialize("")
Dim p As B4XView = iv
p.SetBitmap(bmp)
Parent.AddView(p, x, y, 0, 0)
Dim duration As Int = 3000
p.SetLayoutAnimated(duration, x - radius, y - radius, 2 * radius, 2 * radius)
p.SetVisibleAnimated(duration, False)
Sleep(duration)
p.RemoveViewFromParent
End Sub