Webmaster4o
Jul 04, 2015 - 14:32
Can I use ui.animate to have something slide in from the top? I'm looking at the way the export manu slides down in keynote. I have my view, and I want it to slide in on top from above.
Can I use ui.animate to have something slide in from the top? I'm looking at the way the export manu slides down in keynote. I have my view, and I want it to slide in on top from above.
yes.
# demonstrate simple sliding animation
import ui
v=ui.View(bg_color='white')
v.add_subview(ui.Button(title='push me',bg_color=(.9,1,1),name='b',frame=(400,200,200,200)))
def show_menu(sender):
newv=ui.View(bg_color=(0.8,0.8,0.8),name='menu')
newv.add_subview(ui.Button(title='close',name='close',frame=(200,200,200,200),bg_color=(0.9,1,1)))
newv.width=400
newv.height=400
newv.center=(sender.superview.center[0],-400)
sender.superview.add_subview(newv)
def down():
newv.y=0
ui.animate(down,1.0)
newv['close'].action=close_menu
def close_menu(sender):
def up():
sender.superview.y=-400
ui.animate(up,1.0,completion=lambda:v.remove_subview(sender.superview))
v['b'].action=show_menu
v.present()
Thanks.
Can I add a drop shadow behind this easily?