Fade in and fade out problem
I use Pythonista in Version 2.1.1 (211008) on my iPhone 6 and I want to fade in and fade out a Label on a UI view. I found many examples but none of them works for me.
The scenario: The User of my app presses a button and in the background somthing happens. But the user gets no feedback. So I placed a Label on the screen center and after the button press event I want to show the label a secound and hide it.
I found the animate() function and tried it this way:
def showInfo(Infotext, aView):
aView['MyLabel'].text='This is my message'
If i call the showInfo function the Label fades in on the screen. This works. But after a second I want to fade out the label. I tried many ways to implement a fade out but none of them works. I tried to define an second function called doAnimation2 with aView['MyLabel'].alpha=0 and called it the same way like doAnimate. I also tried to set the alpha value to 0 after the ui.animate call. But the label dosen't show. No fade in, no fade out. I also serached for a definition of the animate function but I only found a very small doku about this.
So, please help me.
How can I fade in and after a secound fade out my label in the example above?
What does the ui.animate function do exactly and what are the parameters of this function.
https://github.com/encela95dus/ios_pythonista_examples Contains few animation examples and I hope it helps
animate1.py - animating color
animation2.py - animating scale, alpha and move
transform playground https://forum.omz-software.com/topic/2268/view-transform-origin
direct replacement for ui.animate with more easing functions and support for chaining several animations to run on sequence
Thanks for the answers. Now I know what is wrong. I didn't mentioned that animated() ist a kind of separate thread and the following codelines ar interpreted while animate() is running.