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.c (1382B)
1 #include "../lv_examples.h" 2 #if LV_BUILD_EXAMPLES && LV_USE_IMG 3 4 /** 5 * Creating a transition 6 */ 7 void lv_example_style_10(void) 8 { 9 static const lv_style_prop_t props[] = {LV_STYLE_BG_COLOR, LV_STYLE_BORDER_COLOR, LV_STYLE_BORDER_WIDTH, 0}; 10 11 /* A default transition 12 * Make it fast (100ms) and start with some delay (200 ms)*/ 13 static lv_style_transition_dsc_t trans_def; 14 lv_style_transition_dsc_init(&trans_def, props, lv_anim_path_linear, 100, 200, NULL); 15 16 /* A special transition when going to pressed state 17 * Make it slow (500 ms) but start without delay*/ 18 static lv_style_transition_dsc_t trans_pr; 19 lv_style_transition_dsc_init(&trans_pr, props, lv_anim_path_linear, 500, 0, NULL); 20 21 static lv_style_t style_def; 22 lv_style_init(&style_def); 23 lv_style_set_transition(&style_def, &trans_def); 24 25 static lv_style_t style_pr; 26 lv_style_init(&style_pr); 27 lv_style_set_bg_color(&style_pr, lv_palette_main(LV_PALETTE_RED)); 28 lv_style_set_border_width(&style_pr, 6); 29 lv_style_set_border_color(&style_pr, lv_palette_darken(LV_PALETTE_RED, 3)); 30 lv_style_set_transition(&style_pr, &trans_pr); 31 32 /*Create an object with the new style_pr*/ 33 lv_obj_t * obj = lv_obj_create(lv_scr_act()); 34 lv_obj_add_style(obj, &style_def, 0); 35 lv_obj_add_style(obj, &style_pr, LV_STATE_PRESSED); 36 37 lv_obj_center(obj); 38 } 39 40 #endif