You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.0 KiB
C
42 lines
1.0 KiB
C
#include "../../lv_examples.h"
|
|
#if LV_USE_IMG && LV_BUILD_EXAMPLES
|
|
|
|
static void ofs_y_anim(void * img, int32_t v)
|
|
{
|
|
lv_img_set_offset_y(img, v);
|
|
}
|
|
|
|
/**
|
|
* Image styling and offset
|
|
*/
|
|
void lv_example_img_4(void)
|
|
{
|
|
LV_IMG_DECLARE(img_skew_strip);
|
|
|
|
static lv_style_t style;
|
|
lv_style_init(&style);
|
|
lv_style_set_bg_color(&style, lv_palette_main(LV_PALETTE_YELLOW));
|
|
lv_style_set_bg_opa(&style, LV_OPA_COVER);
|
|
lv_style_set_img_recolor_opa(&style, LV_OPA_COVER);
|
|
lv_style_set_img_recolor(&style, lv_color_black());
|
|
|
|
lv_obj_t * img = lv_img_create(lv_scr_act());
|
|
lv_obj_add_style(img, &style, 0);
|
|
lv_img_set_src(img, &img_skew_strip);
|
|
lv_obj_set_size(img, 150, 100);
|
|
lv_obj_center(img);
|
|
|
|
lv_anim_t a;
|
|
lv_anim_init(&a);
|
|
lv_anim_set_var(&a, img);
|
|
lv_anim_set_exec_cb(&a, ofs_y_anim);
|
|
lv_anim_set_values(&a, 0, 100);
|
|
lv_anim_set_time(&a, 3000);
|
|
lv_anim_set_playback_time(&a, 500);
|
|
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
|
lv_anim_start(&a);
|
|
|
|
}
|
|
|
|
#endif
|