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_style_10.py (944B)

      1 #
      2 # Creating a transition
      3 #
      4 
      5 props = [lv.STYLE.BG_COLOR, lv.STYLE.BORDER_COLOR, lv.STYLE.BORDER_WIDTH, 0]
      6 
      7 # A default transition
      8 # Make it fast (100ms) and start with some delay (200 ms)
      9 
     10 trans_def = lv.style_transition_dsc_t()
     11 trans_def.init(props, lv.anim_t.path_linear, 100, 200, None)
     12 
     13 # A special transition when going to pressed state
     14 # Make it slow (500 ms) but start  without delay
     15 
     16 trans_pr = lv.style_transition_dsc_t()
     17 trans_pr.init(props, lv.anim_t.path_linear, 500, 0, None)
     18 
     19 style_def = lv.style_t()
     20 style_def.init()
     21 style_def.set_transition(trans_def)
     22 
     23 style_pr = lv.style_t()
     24 style_pr.init()
     25 style_pr.set_bg_color(lv.palette_main(lv.PALETTE.RED))
     26 style_pr.set_border_width(6)
     27 style_pr.set_border_color(lv.palette_darken(lv.PALETTE.RED, 3))
     28 style_pr.set_transition(trans_pr)
     29 
     30 # Create an object with the new style_pr
     31 obj = lv.obj(lv.scr_act())
     32 obj.add_style(style_def, 0)
     33 obj.add_style(style_pr, lv.STATE.PRESSED)
     34 
     35 obj.center()