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_btn_3.py (1271B)
1 # 2 # Create a style transition on a button to act like a gum when clicked 3 # 4 5 # Properties to transition 6 props = [lv.STYLE.TRANSFORM_WIDTH, lv.STYLE.TRANSFORM_HEIGHT, lv.STYLE.TEXT_LETTER_SPACE, 0] 7 8 # Transition descriptor when going back to the default state. 9 # Add some delay to be sure the press transition is visible even if the press was very short*/ 10 transition_dsc_def = lv.style_transition_dsc_t() 11 transition_dsc_def.init(props, lv.anim_t.path_overshoot, 250, 100, None) 12 13 # Transition descriptor when going to pressed state. 14 # No delay, go to pressed state immediately 15 transition_dsc_pr = lv.style_transition_dsc_t() 16 transition_dsc_pr.init(props, lv.anim_t.path_ease_in_out, 250, 0, None) 17 18 # Add only the new transition to the default state 19 style_def = lv.style_t() 20 style_def.init() 21 style_def.set_transition(transition_dsc_def) 22 23 # Add the transition and some transformation to the presses state. 24 style_pr = lv.style_t() 25 style_pr.init() 26 style_pr.set_transform_width(10) 27 style_pr.set_transform_height(-10) 28 style_pr.set_text_letter_space(10) 29 style_pr.set_transition(transition_dsc_pr) 30 31 btn1 = lv.btn(lv.scr_act()) 32 btn1.align(lv.ALIGN.CENTER, 0, -80) 33 btn1.add_style(style_pr, lv.STATE.PRESSED) 34 btn1.add_style(style_def, 0) 35 36 label = lv.label(btn1) 37 label.set_text("Gum") 38