Label Animation...

Gary Miyakawa

Active Member
Licensed User
Longtime User
Ok, I'm able to animate (fade out) a label using the following code... What I want to be able to do, is fade it back in... My problem is I can't figure out how to specify (programatically) how to set the "alpha" on the label to 0...

I know it's probably obvious but I'm not figuring it out (and I've searched)...

Thanks (again!)

B4X:
'Activity module
Sub Process_Globals
   'These global variables will be declared once when the application starts.
   'These variables can be accessed from all modules.
End Sub
Sub Globals
   'These global variables will be redeclared each time the activity is created.
   'These variables can only be accessed from this module.
   Dim TL As Animation
   Dim Test_Label As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("A")
   TL.InitializeAlpha("", 1, 0)
   TL.Duration = 3000
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Trigger_Click
   TL.Start(Test_Label)
   Test_Label.Visible = False
End Sub
 

kickaha

Well-Known Member
Licensed User
Longtime User
I am pretty sure the color property sets the alpha:

B4X:
Test_Label.Color=colors.ARGB(Alpha, R, G, B)
 
Upvote 0

Gary Miyakawa

Active Member
Licensed User
Longtime User
Thanks kickaha but I'm still struggling with this....

Any other thoughts out there? My goal is to fade in (make visible) a label across a 3 second time span..

Thanks,

Gary M
 
Upvote 0

ssg

Well-Known Member
Licensed User
Longtime User
2 options:

you could try creating a new animation variable, for example:

dim TL2 as animation
TL2.InitializeAlpha("", 0, 1 ) 'change the locations of 0 and 1

then call TL2.start.

If you want to fade in once the fade out is complete, then you need to trigger the animation end event when the first animation ends, and then start the 2nd fade in animation.

OR

you could set the animations repeat to be 1 and set TL.RepeatMode = TL.REPEAT_REVERSE so it auto fades back in .

Hope that helps. Cant give exact codes now, no access :)
 
Upvote 0
Top