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