lv_lottie.h

Typedefs

typedef struct _Tvg_Paint Tvg_Paint
typedef struct _Tvg_Canvas Tvg_Canvas
typedef struct _Tvg_Animation Tvg_Animation

Functions

lv_obj_t *lv_lottie_create(lv_obj_t *parent)

Create a lottie animation

Parameters:

parent -- pointer to the parent widget

Returns:

pointer to the created Lottie animation widget

void lv_lottie_set_buffer(lv_obj_t *obj, int32_t w, int32_t h, void *buf)

Set a buffer for the animation. It also defines the size of the animation

Parameters:
  • obj -- pointer to a lottie widget

  • w -- width of the animation and buffer

  • h -- height of the animation and buffer

  • buf -- a static buffer with width x height x 4 byte size

void lv_lottie_set_draw_buf(lv_obj_t *obj, lv_draw_buf_t *draw_buf)

Set a draw buffer for the animation. It also defines the size of the animation

Parameters:
  • obj -- pointer to a lottie widget

  • draw_buf -- an initialized draw buffer with ARGB8888 color format

void lv_lottie_set_src_data(lv_obj_t *obj, const void *src, size_t src_size)

Set the source for the animation as an array

Parameters:
  • obj -- pointer to a lottie widget

  • src -- the lottie animation converted to an nul terminated array

  • src_size -- size of the source array in bytes

void lv_lottie_set_src_file(lv_obj_t *obj, const char *src)

Set the source for the animation as a path. Lottie doesn't use LVGL's File System API.

Parameters:
  • obj -- pointer to a lottie widget

  • src -- path to a json file, e.g. "path/to/file.json"

lv_anim_t *lv_lottie_get_anim(lv_obj_t *obj)

Get the LVGL animation which controls the lottie animation

Parameters:

obj -- pointer to a lottie widget

Returns:

the LVGL animation

struct lv_lottie_t

Public Members

lv_canvas_t canvas
Tvg_Paint *tvg_paint
Tvg_Canvas *tvg_canvas
Tvg_Animation *tvg_anim
lv_anim_t *anim
int32_t last_rendered_time