Animation Image (lv_animimg)
Overview
The animation image is similar to the normal 'Image' object. The only difference is that instead of one source image, you set an array of multiple source images.
You can specify a duration and repeat count.
Parts and Styles
LV_PART_MAIN
A background rectangle that uses the typical background style properties and the image itself using the image style properties.
Usage
Image sources
To set the image in a state, use the lv_animimg_set_src(imagebutton, dsc[], num).
Using the inner animation
For more advanced use cases, the animation internally used by the image can be retrieved using the lv_animimg_get_anim(image). This way, the Animation functions can be used, for example to override the animation values using the lv_anim_set_values(anim, start, end) or to set a callback on the animation completed event.
Events
No special events are sent by image objects.
See the events of the Base object too.
Learn more about Events.
Keys
No Keys are processed by the object type.
Learn more about Keys.
Example
Simple Animation Image
C code
View on GitHub#include "../../lv_examples.h"
#if LV_USE_ANIMIMG && LV_BUILD_EXAMPLES
LV_IMAGE_DECLARE(animimg001);
LV_IMAGE_DECLARE(animimg002);
LV_IMAGE_DECLARE(animimg003);
static const lv_image_dsc_t * anim_imgs[3] = {
&animimg001,
& animimg002,
& animimg003,
};
void lv_example_animimg_1(void)
{
lv_obj_t * animimg0 = lv_animimg_create(lv_screen_active());
lv_obj_center(animimg0);
lv_animimg_set_src(animimg0, (const void **) anim_imgs, 3);
lv_animimg_set_duration(animimg0, 1000);
lv_animimg_set_repeat_count(animimg0, LV_ANIM_REPEAT_INFINITE);
lv_animimg_start(animimg0);
}
#endif