Android Question Stop a running animation

RodM

Member
Licensed User
Hello all!

My app has a label that runs a SetColorAnimated during 45 seconds.
I need to stop that animation imediatelly and reset the label color, when an specific event occurs, (eg. click on a button).
When I just reset the original color, just after that, the animation continues running until its preset timer ends.

Is there any way in B4A to stop a running animation immediatelly before its preset time ends?

Thanks in advance.
 

mangojack

Well-Known Member
Licensed User
Longtime User
This worked for me ... Clicking the Button immediately stopped the animation .

B4X:
Label1.SetColorAnimated(45000, Colors.White, Colors.Red)

Private Sub Button1_Click

    Label1.Color = Colors.White  'Or

    'Label1.SetColorAnimated(0, Colors.Red, Colors.White)

End Sub

If you still have troubles you might want to show some of your code.
 
Last edited:
Upvote 0

RodM

Member
Licensed User
This worked for me ... Clicking the Button immediately stopped the animation .

B4X:
Label1.SetColorAnimated(45000, Colors.White, Colors.Red)

Private Sub Button1_Click

    Label1.Color = Colors.White  'Or

    'Label1.SetColorAnimated(0, Colors.Red, Colors.White)

End Sub

If you still have troubles you might want to show some of your code.
When I just reset the original color, just after that, the animation continues running until its preset timer ends.
Thanks for your answer but, as I said, I did exactly what you suggest but the animation doesn't stop. Changing the color is not enough. In my case, the label is transitioning between its color to transparent (fading out).

I'll post the code later, thank you.
 
Upvote 0
Top