1 #include "../../lv_examples.h"
2 #if LV_BUILD_EXAMPLES
3 #if LV_USE_LOTTIE
4
5 /**
6 * Load an lottie animation from file
7 */
lv_example_lottie_2(void)8 void lv_example_lottie_2(void)
9 {
10
11 lv_obj_t * lottie = lv_lottie_create(lv_screen_active());
12 lv_lottie_set_src_file(lottie, "lvgl/examples/widgets/lottie/lv_example_lottie_approve.json");
13
14 #if LV_DRAW_BUF_ALIGN == 4 && LV_DRAW_BUF_STRIDE_ALIGN == 1
15 /*If there are no special requirements, just declare a buffer
16 x4 because the Lottie is rendered in ARGB8888 format*/
17 static uint8_t buf[64 * 64 * 4];
18 lv_lottie_set_buffer(lottie, 64, 64, buf);
19 #else
20 /*For GPUs and special alignment/strid setting use a draw_buf instead*/
21 LV_DRAW_BUF_DEFINE(draw_buf, 64, 64, LV_COLOR_FORMAT_ARGB8888);
22 lv_lottie_set_draw_buf(lottie, &draw_buf);
23 #endif
24
25 lv_obj_center(lottie);
26 }
27
28 #else
29
lv_example_lottie_2(void)30 void lv_example_lottie_2(void)
31 {
32 /*fallback for online examples*/
33
34 lv_obj_t * label = lv_label_create(lv_screen_active());
35 lv_label_set_text(label, "Lottie cannot be previewed online");
36 lv_obj_center(label);
37 }
38
39 #endif /*LV_USE_LOTTIE*/
40
41 #endif /*LV_BUILD_EXAMPLES*/
42