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_img_4.c (1044B)

      1 #include "../../lv_examples.h"
      2 #if LV_USE_IMG && LV_BUILD_EXAMPLES
      3 
      4 static void ofs_y_anim(void * img, int32_t v)
      5 {
      6     lv_img_set_offset_y(img, v);
      7 }
      8 
      9 /**
     10  * Image styling and offset
     11  */
     12 void lv_example_img_4(void)
     13 {
     14     LV_IMG_DECLARE(img_skew_strip);
     15 
     16     static lv_style_t style;
     17     lv_style_init(&style);
     18     lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_YELLOW));
     19     lv_style_set_bg_opa(&style, LV_OPA_COVER);
     20     lv_style_set_img_recolor_opa(&style, LV_OPA_COVER);
     21     lv_style_set_img_recolor(&style, lv_color_black());
     22 
     23     lv_obj_t * img = lv_img_create(lv_scr_act());
     24     lv_obj_add_style(img, &style, 0);
     25     lv_img_set_src(img, &img_skew_strip);
     26     lv_obj_set_size(img, 150, 100);
     27     lv_obj_center(img);
     28 
     29     lv_anim_t a;
     30     lv_anim_init(&a);
     31     lv_anim_set_var(&a, img);
     32     lv_anim_set_exec_cb(&a, ofs_y_anim);
     33     lv_anim_set_values(&a, 0, 100);
     34     lv_anim_set_time(&a, 3000);
     35     lv_anim_set_playback_time(&a, 500);
     36     lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
     37     lv_anim_start(&a);
     38 
     39 }
     40 
     41 #endif