Android Question how to set property label.setcoloranimated continuous

Nitin Joshi

Member
Licensed User
Hi, I want help to know, how to keep changing color of label using setcoloranimated continuously? As i observed that color animation stops after set interval.
 

Sagenut

Well-Known Member
Licensed User
Try if this can be useful to You.
 

Attachments

Erel

Administrator
Staff member
Licensed User
B4X:
Sub Process_Globals
   Private ColorsLoopIndex As Int
   Private xui As XUI
End Sub

Sub Globals
   Private Label1 As B4XView
End Sub

Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   ChangeColorContinuously(Label1, Array As Int(xui.Color_Red, xui.Color_Green, xui.Color_Blue), 1000)
End Sub

Sub ChangeColorContinuously (v As B4XView, Clrs() As Int, Duration As Int)
   Dim MyIndex As Int = ColorsLoopIndex
   Dim i As Int
   Do While MyIndex = ColorsLoopIndex
       Dim FirstColor As Int = Clrs(i)
       i = (i + 1) Mod Clrs.Length
       Dim SecondColor As Int = Clrs(i)
       v.SetColorAnimated(Duration, FirstColor, SecondColor)
       Sleep(Duration)
   Loop
End Sub

Sub StopColorsAnimations
   ColorsLoopIndex = ColorsLoopIndex + 1
End Sub
 
Top