Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Fade in and fade out problem
-
Hi
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):
def doAnimation():
aView['MyLabel'].alpha=1aView['MyLabel'].text='This is my message'
ui.animate(doAnimation)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.
Many thanks
kluesi
-
-
https://github.com/encela95dus/ios_pythonista_examples Contains few animation examples and I hope it helps
animation examples
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
https://github.com/controversial/ui2/blob/master/ui2/animate.py
viewslide.py
delay_test.py
from forum
https://forum.omz-software.com/topic/3504/lab-ui-animate-sliding-in-views
gstate https://forum.omz-software.com/topic/3180/understanding-ui-transform-rotation -
-
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.
Thank you