[English]

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.


LV_PART_MAIN 使用典型背景样式属性和图像本身使用图像样式属性。

Usage(用法)

Image sources(图片来源)

显示原文

To set the image in a state, use the lv_animimg_set_src(imagebutton, dsc[], num).


若要将图像设置为状态,请使用 lv_animimg_set_src(imagebutton, dsc[], num)

Events(事件)

显示原文

No special events are sent by image objects.

See the events of the Base object too.

Learn more about Events(事件).


图像对象不会发送任何特殊事件。

另请参阅 Base 对象的事件。

详细了解 Events(事件)

Keys(按键)

显示原文

No Keys are processed by the object type.

Learn more about Keys(按键).


对象类型不处理任何键。

了解有关 Keys(按键) 的更多信息。

Example

[English]

Simple Animation Image

A simple example to demonstrate the use of an animation image.
#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

API

lv_animimage.h