Hi all,
Just a small sharing.
Using a timer to make a raindrop or snow effect.I don't know whether it's the correct way to do this. =D
Just a small sharing.
Using a timer to make a raindrop or snow effect.I don't know whether it's the correct way to do this. =D
B4X:
Sub Timer_rain_Tick
Dim image As ImageView
image.Initialize("")
'image.Bitmap =LoadBitmap(File.DirAssets, "drop.png")
image.Bitmap =LoadBitmap(File.DirAssets, "snow.png")
Dim left As Int =Rnd(0,100)
Panel1.AddView(image,(left*Panel1.Width)/100,-20%x,16dip,16dip)
Dim a As Int = Rnd(0,10)
If a >5 Then 'If there is already an image/logo in screen, make it randomly fall from front/back
image.SendToBack
Else
image.BringToFront
End If
image.SetLayoutAnimated(5000,image.Left,120%y,image.Width,image.Height)
image.SetVisibleAnimated(5000,False)
Sleep(5000)
image.RemoveView
End Sub