[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) 为动画图像设置图像源,参数 dsc 是包含一个或多个图像源的数组,参数num是图像源的个数。

Events(事件)

显示原文

No special events are sent by image objects.

See the events of the Base object too.

Learn more about Events(事件).


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

另请参阅基础对象的事件。

详细了解阅读 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_types.h

lv_animimage.h