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_bar_3.c (1089B)
1 #include "../../lv_examples.h" 2 #if LV_USE_BAR && LV_BUILD_EXAMPLES 3 4 static void set_temp(void * bar, int32_t temp) 5 { 6 lv_bar_set_value(bar, temp, LV_ANIM_ON); 7 } 8 9 /** 10 * A temperature meter example 11 */ 12 void lv_example_bar_3(void) 13 { 14 static lv_style_t style_indic; 15 16 lv_style_init(&style_indic); 17 lv_style_set_bg_opa(&style_indic, LV_OPA_COVER); 18 lv_style_set_bg_color(&style_indic, lv_palette_main(LV_PALETTE_RED)); 19 lv_style_set_bg_grad_color(&style_indic, lv_palette_main(LV_PALETTE_BLUE)); 20 lv_style_set_bg_grad_dir(&style_indic, LV_GRAD_DIR_VER); 21 22 lv_obj_t * bar = lv_bar_create(lv_scr_act()); 23 lv_obj_add_style(bar, &style_indic, LV_PART_INDICATOR); 24 lv_obj_set_size(bar, 20, 200); 25 lv_obj_center(bar); 26 lv_bar_set_range(bar, -20, 40); 27 28 lv_anim_t a; 29 lv_anim_init(&a); 30 lv_anim_set_exec_cb(&a, set_temp); 31 lv_anim_set_time(&a, 3000); 32 lv_anim_set_playback_time(&a, 3000); 33 lv_anim_set_var(&a, bar); 34 lv_anim_set_values(&a, -20, 40); 35 lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE); 36 lv_anim_start(&a); 37 } 38 39 40 #endif