Alpha Animation Question

pixelpop

Active Member
Licensed User
Longtime User
I have a label that I am attempting to fade out, change the label text and then fade the label back in. I declared FadeInOut as an Animation. Here is the releveant code:

B4X:
Sub Activity_Create(FirstTime As Boolean)
   Timer1.Initialize("Timer1", 5000) 
   FadeInOut.InitializeAlpha("anim",1,0)
   FadeInOut.Duration = 2000
   lblValue.text = "Testing"
   Timer1.Enabled = True
End Sub

Sub Timer1_Tick
   Timer1.Enabled = False
   FadeInOut.Start(lblValue)
End Sub

Sub anim_AnimationEnd
   lblValue.Text = "Testing2"
   FadeInOut.RepeatMode = FadeInOut.REPEAT_REVERSE
   Timer1.Enabled = True
End Sub

My problem is that if I break on the first line of the AnimationEnd code, the label has popped back into view with 100% alpha and the text assigned in the Activity_Create code.
 

pixelpop

Active Member
Licensed User
Longtime User
Great answer! Why didn't I think of that? :)

So, I added this code at the start of AnimationEnd:

B4X:
lblValue.Color = Colors.ARGB(0,255,255,255)
lblValue.Text = "Testing"

And the fade works great. I also noticed that FadeInOut.RepeatMode = FadeInOut.REPEAT_REVERSE wasn't working, so I just created a second FadeIn animation to handle that part. Everything works great now. Thanks.
 
Upvote 0
Top