acid-drop- Hacking the planet from a LilyGo T-Deck using custom firmware |
git clone git://git.acid.vegas/acid-drop.git |
Log | Files | Refs | Archive | README | LICENSE |
lv_example_anim_1.py (981B)
1 def anim_x_cb(label, v): 2 label.set_x(v) 3 4 def sw_event_cb(e,label): 5 sw = e.get_target() 6 7 if sw.has_state(lv.STATE.CHECKED): 8 a = lv.anim_t() 9 a.init() 10 a.set_var(label) 11 a.set_values(label.get_x(), 100) 12 a.set_time(500) 13 a.set_path_cb(lv.anim_t.path_overshoot) 14 a.set_custom_exec_cb(lambda a,val: anim_x_cb(label,val)) 15 lv.anim_t.start(a) 16 else: 17 a = lv.anim_t() 18 a.init() 19 a.set_var(label) 20 a.set_values(label.get_x(), -label.get_width()) 21 a.set_time(500) 22 a.set_path_cb(lv.anim_t.path_ease_in) 23 a.set_custom_exec_cb(lambda a,val: anim_x_cb(label,val)) 24 lv.anim_t.start(a) 25 26 # 27 # Start animation on an event 28 # 29 30 label = lv.label(lv.scr_act()) 31 label.set_text("Hello animations!") 32 label.set_pos(100, 10) 33 34 35 sw = lv.switch(lv.scr_act()) 36 sw.center() 37 sw.add_state(lv.STATE.CHECKED) 38 sw.add_event_cb(lambda e: sw_event_cb(e,label), lv.EVENT.VALUE_CHANGED, None) 39 40 41