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.
Fading images at load
-
Hi I’m trying to load in an image using ui.imageView then setting the alpha to 0.0 and then using ui.animate to alter that alpha to a non zero value. I can’t get this to gradually fade however - the alpha just jumps after the specified time.
What am I doing wrong here? This simple solution has worked fine for me previously for buttons etc.
I’m going for a gradually blending slideshow effect. -
@rb try this
import ui iv = ui.ImageView() iv.frame = (0,0,400,400) v = ui.View() v.frame = iv.frame v.background_color = (1,1,1,0) iv.add_subview(v) iv.present('sheet') iv.image = ui.Image.named('test:Peppers') def anim(): v.background_color = (1,1,1,1) ui.animate(anim,5)
-
Thankyou - that’s masking an image with a colour and altering the alpha of the colour - isnt there a way to gradually alter an imageViews alpha over time?
-
@rb try
import ui from objc_util import * iv = ui.ImageView() iv.frame = (0,0,400,400) ObjCInstance(iv).alpha = 0 iv.present('sheet') iv.image = ui.Image.named('test:Peppers') def anim(): ObjCInstance(iv).alpha = 1 ui.animate(anim,5)
-
Thanks that’s exactly what I’m after!
-