LVGL v8 seqframe (seqimg)
SiFli SDK provides a picture frame-sequence playback widget on LVGL v8, with the corresponding SDK header lvsf/lv_seqimg.h (widget class name lv_seqimg). Built on top of the LVGL image object, it plays a group of pictures frame by frame in order. It supports two resource sources—memory-packed frame sequences (an lv_img_dsc_t array) and individual pictures on a file system (an array of file paths)—and supports play, pause, frame selection by index, and frame-interval setting.
Note
The lv_seqframe_* interfaces used in the solution document differ in naming from the lv_seqimg_* interfaces in the current SDK v8 header lvsf/lv_seqimg.h. The API table in this document follows the SDK header; the playback modes, prefix paths, and other feature descriptions related to lv_seqframe_* can serve as a design reference.
Features
Plays a group of pictures frame by frame in order, supporting both memory-array and file-path-array sources.
Supports play / pause control and directly selecting a frame by index for display.
Supports setting the frame playback interval.
Resources can be frame sequences built into firmware, or individual pictures named by sequence number on a file system.
Use Cases
Looping frame sequences such as loading animations, WiFi-connecting animations, and charging animations.
Simple animations that play extracted video frames in order.
Scenarios that require frames to be stored by sequence number on a file system (such as an SD card) and loaded one by one.
Supported Boards
Any platform supported by the general LVGL v8 examples, and any board from 55x onward (such as 58x, 56x, 52x).
Configuration and Initialization
The frame-sequence widget is provided by lvsf/lv_seqimg.h and is enabled as part of the LVGL v8 build:
#include "lvsf/lv_seqimg.h"
API Reference
The interface signatures below are taken verbatim from middleware/lvgl/lvsf/lv_seqimg.h:
Function |
Description |
Parameters / Returns |
|---|---|---|
|
Create a frame-sequence widget instance |
|
|
Bind an in-memory array of frame descriptors |
|
|
Bind an array of image paths on the file system |
|
|
Jump to and display the frame at the given index |
|
|
Start playing the frame sequence |
No return value |
|
Pause playback |
No return value |
|
Set the frame playback interval |
|
Typical Usage
Play a frame sequence built into firmware:
/* dsc_array is an array of lv_img_dsc_t pointers in playback order, count is the number of frames */
lv_obj_t *seqframe = lv_seqimg_create(lv_scr_act());
lv_seqimg_src_array(seqframe, dsc_array, count);
lv_seqimg_set_period(seqframe, 50); /* frame interval 50ms */
lv_seqimg_select(seqframe, 0); /* start from frame 0 */
lv_obj_align(seqframe, LV_ALIGN_CENTER, 0, 0);
lv_seqimg_play(seqframe);
Play individual pictures named by sequence number on the file system:
const char *paths[] = {"/sd/photo/beauty0.bin",
"/sd/photo/beauty1.bin",
"/sd/photo/beauty2.bin"};
lv_obj_t *seq = lv_seqimg_create(lv_scr_act());
lv_seqimg_file_array(seq, paths, 3);
lv_seqimg_set_period(seq, 500);
lv_seqimg_select(seq, 0);
lv_seqimg_play(seq);
Note
When playing individually from the file system, external resource files must be named in playback order as “image name + consecutive numeric sequence + uniform suffix”, so that the widget can load them correctly by index. The built-in array and the file array are mutually exclusive; do not configure both sources on the same widget.
Demo
See Also
Source path:
middleware/lvgl/lvsf/lv_seqimg.h