def show_buttons(sender, data): # shorthand to unhide items before running animation animate.add("opacity", "Info", 0, 1, [.64, .12, .72, .86], 20, timeoffset=10 / 60) animate.add( "opacity", "Animate Position", 0, 1, [.64, .12, .72, .86], 20, timeoffset=15 / 60, early_callback=lambda sender, data: show_item("Animate Position")) animate.add("opacity", "Animate Size", 0, 1, [.64, .12, .72, .86], 20, timeoffset=20 / 60, early_callback=lambda sender, data: show_item("Animate Size")) animate.add( "opacity", "Animate Opacity", 0, 1, [.64, .12, .72, .86], 20, timeoffset=25 / 60, early_callback=lambda sender, data: show_item("Animate Opacity"))
def loop_cycle(sender, data): animate.add("position", "Loop1", [565, 300], [1500, 300], [.51, .05, .5, .9], 30, callback=lambda sender, data: hide_item("Loop1")) animate.remove("pp_loop") animate.add("opacity", "Loop2", 0, 1, [.51, .05, .5, .9], 30, timeoffset=1, early_callback=lambda sender, data: show_item("Loop2")) animate.add("size", "Loop2", [0, 0], [180, 110], [.06, .54, .11, .98], 85, timeoffset=1, loop="cycle", name="cycleloop_size") animate.add("position", "Loop2", [639, 339], [565, 300], [.06, .54, .11, .98], 85, timeoffset=1, loop="cycle", name="cycleloop_pos")
def remove_size_demo(sender, data): animate.remove("size_loop") animate.remove("pos_loop") animate.remove("size_loop_btn1") animate.remove("size_loop_btn2") animate.remove("size_loop_btn3") hide_item("Size Demo") animate.add("position", "Demo", [20, 20], [562, 225], [.51, .05, .5, .9], 40) animate.add("size", "Demo", [156, 80], [156, 170], [.51, .05, .5, .9], 40) animate.add("opacity", "Demo", 0.5, 1, [.51, .05, .5, .9], 40)
def gotoDemo(sender, data): if data == "position": call = demo_position elif data == "size": call = demo_size elif data == "opacity": call = demo_opacity animate.add("position", "Demo", [562, 225], [20, 20], [.51, .05, .5, .9], 40) animate.add("size", "Demo", [156, 170], [156, 80], [.51, .05, .5, .9], 40) animate.add("opacity", "Demo", 1, 0.5, [.51, .05, .5, .9], 40, callback=call)
def loop_close(sender, data): animate.remove("cont_loop") hide_item("Loop3") animate.remove("top1") animate.remove("top2") animate.remove("top3") animate.remove("top4") hide_item("Opacity Demo1") hide_item("Opacity Demo2") hide_item("Opacity Demo3") hide_item("Opacity Demo4") animate.add("position", "Demo", [20, 20], [562, 225], [.51, .05, .5, .9], 40) animate.add("size", "Demo", [156, 80], [156, 170], [.51, .05, .5, .9], 40) animate.add("opacity", "Demo", 0.5, 1, [.51, .05, .5, .9], 40)
def loop_continue(sender, data): animate.remove("cycleloop_size") animate.remove("cycleloop_pos") x, y = get_window_pos("Loop2") animate.add("position", "Loop2", [x, y], [x, 800], [.06, .54, .11, .98], 20) animate.add("opacity", "Loop2", 1, 0, [.06, .54, .11, .98], 20, callback=lambda sender, data: hide_item("Loop2")) animate.add("position", "Loop3", [-300, 300], [-250, 300], [.01, .97, .1, .98], 30, loop="continue", callback=checkforEnd, name="cont_loop") show_item("Loop3")
def demo_opacity(sender, data): animate.add("opacity", "Opacity Demo1", 0, 1, [.51, .05, .5, .9], 60, timeoffset=2 / 60, early_callback=lambda sender, data: show_item("Opacity Demo1"), loop="ping-pong", name="top1") animate.add("opacity", "Opacity Demo2", 0, 1, [.51, .05, .5, .9], 60, timeoffset=22 / 60, early_callback=lambda sender, data: show_item("Opacity Demo2"), loop="ping-pong", name="top2") animate.add("opacity", "Opacity Demo3", 0, 1, [.51, .05, .5, .9], 60, timeoffset=42 / 60, early_callback=lambda sender, data: show_item("Opacity Demo3"), loop="ping-pong", name="top3") animate.add("opacity", "Opacity Demo4", 0, 1, [.51, .05, .5, .9], 60, timeoffset=62 / 60, early_callback=lambda sender, data: show_item("Opacity Demo4"), loop="ping-pong", name="top4") animate.add("opacity", "Loop1", 0.4, 1, [.51, .05, .5, .9], 10, timeoffset=122 / 60, loop="ping-pong", name="pp_loop") animate.add("position", "Loop1", [565, 800], [565, 300], [.51, .05, .5, .9], 30, timeoffset=125 / 60, early_callback=lambda sender, data: show_item("Loop1"))
def demo_size(sender, data): # default values animate.add("opacity", "Size Demo", 1, 0, [.51, .05, .5, .9], 1) animate.add("size", "Size Demo", [220, 120], [220, 120], [.51, .05, .5, .9], 1) animate.add("position", "Size Demo", [530, 260], [530, 260], [.51, .05, .5, .9], 1) animate.add("size", "continued", [204, 20], [204, 20], [.51, .05, .5, .9], 1) animate.add("size", "paused", [204, 20], [204, 20], [.51, .05, .5, .9], 1) animate.add("size", "terminated", [204, 20], [204, 20], [.51, .05, .5, .9], 1) animate.add("opacity", "Size Demo", 0, 1, [.51, .05, .5, .9], 60, timeoffset=2 / 60, early_callback=lambda sender, data: show_item("Size Demo")) animate.add("size", "Size Demo", [220, 120], [500, 360], [.51, .05, .5, .9], 120, loop="ping-pong", name="size_loop") animate.add("position", "Size Demo", [530, 260], [390, 70], [.51, .05, .5, .9], 120, loop="ping-pong", name="pos_loop") animate.add("size", "continued", [204, 20], [484, 100], [.51, .05, .5, .9], 120, loop="ping-pong", name="size_loop_btn1") animate.add("size", "paused", [204, 20], [484, 100], [.51, .05, .5, .9], 120, loop="ping-pong", name="size_loop_btn2") animate.add("size", "terminated", [204, 20], [484, 100], [.51, .05, .5, .9], 120, loop="ping-pong", name="size_loop_btn3") animate.pause("size_loop") animate.pause("pos_loop") animate.pause("size_loop_btn1") animate.pause("size_loop_btn2") animate.pause("size_loop_btn3")
def remove_pos_demo(sender, data): hide_item("Position Demo") animate.add("position", "Demo", [20, 20], [562, 225], [.51, .05, .5, .9], 40) animate.add("size", "Demo", [156, 80], [156, 170], [.51, .05, .5, .9], 40) animate.add("opacity", "Demo", 0.5, 1, [.51, .05, .5, .9], 40)
def demo_position(sender, data): # default values delete_item("pos_info") add_text("pos_info", default_value= "Animations can be stagged,\nindividual values will add up", parent="Position Demo", before="spacing") set_window_pos("Position Demo", 1500, -100) animate.add("opacity", "Position Demo", 0, 1, [.51, .05, .5, .9], 1) show_item("Position Demo") # animations overlapping in time adding up their values animate.add("position", "Position Demo", [1280, -100], [200, -100], [.51, .05, .5, .9], 600) animate.add("position", "Position Demo", [1280, -100], [1280, 300], [.51, .05, .5, .9], 600) animate.add("position", "Position Demo", [1280, -100], [1000, 0], [.51, .05, .5, .9], 30) animate.add("position", "Position Demo", [0, 0], [50, 50], [.51, .05, .5, .9], 100, timeoffset=4) animate.add("position", "Position Demo", [0, 0], [200, 0], [.51, .05, .5, .9], 100, timeoffset=5) animate.add("position", "Position Demo", [0, 0], [0, 200], [.51, .05, .5, .9], 100, timeoffset=6) animate.add("position", "Position Demo", [0, 0], [0, -200], [.51, .05, .5, .9], 100, timeoffset=7) animate.add("position", "Position Demo", [0, 0], [500, -300], [.51, .05, .5, .9], 60, timeoffset=9) animate.add("position", "Position Demo", [670, 150], [500, 300], [.51, .05, .5, .9], 10, timeoffset=10) # animations cancel each other out, because they are exactly the same but with different directions animate.add("position", "Position Demo", [500, 300], [500, 0], [.51, .05, .5, .9], 300, timeoffset=11, early_callback=update_demo_position_text) animate.add("position", "Position Demo", [500, 300], [500, 600], [.51, .05, .5, .9], 300, timeoffset=11) animate.add("opacity", "Position Demo", 1, 0, [.51, .05, .5, .9], 20, timeoffset=18, callback=remove_pos_demo)
no_resize=True, no_move=True, no_collapse=True, no_scrollbar=True, no_close=True, no_title_bar=True): add_text("loop_info_3", default_value=" continue") add_text("loop_des_3", default_value= "Moves from start to end\ntakes end as start\nrepeats movement") add_spacing(count=3, name="7") add_button("next_loop_3", width=164, label="close", callback=loop_close) hide_item("Loop3") # Start Animation animate.add("position", "Demo", [622, 800], [622, 304], [0, .06, .2, .99], 60) animate.add("opacity", "Demo", 0, 1, [.57, .06, .61, .86], 60) animate.add("size", "Demo", [36, 32], [156, 32], [0, .99, .47, 1], 30, timeoffset=1.5, callback=show_buttons) animate.add("size", "Demo", [156, 32], [156, 170], [0, .65, .59, .92], 30, timeoffset=2) animate.add("position", "Demo", [622, 304], [562, 304], [0, .99, .47, 1], 30, timeoffset=1.5) animate.add("position",