1 #include "../../lv_examples.h"
2 #if LV_USE_FLEX && LV_BUILD_EXAMPLES
3
row_gap_anim(void * obj,int32_t v)4 static void row_gap_anim(void * obj, int32_t v)
5 {
6 lv_obj_set_style_pad_row(obj, v, 0);
7 }
8
column_gap_anim(void * obj,int32_t v)9 static void column_gap_anim(void * obj, int32_t v)
10 {
11 lv_obj_set_style_pad_column(obj, v, 0);
12 }
13
14 /**
15 * Demonstrate the effect of column and row gap style properties
16 */
lv_example_flex_5(void)17 void lv_example_flex_5(void)
18 {
19 lv_obj_t * cont = lv_obj_create(lv_scr_act());
20 lv_obj_set_size(cont, 300, 220);
21 lv_obj_center(cont);
22 lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);
23
24 uint32_t i;
25 for(i = 0; i < 9; i++) {
26 lv_obj_t * obj = lv_obj_create(cont);
27 lv_obj_set_size(obj, 70, LV_SIZE_CONTENT);
28
29 lv_obj_t * label = lv_label_create(obj);
30 lv_label_set_text_fmt(label, "%"LV_PRIu32, i);
31 lv_obj_center(label);
32 }
33
34 lv_anim_t a;
35 lv_anim_init(&a);
36 lv_anim_set_var(&a, cont);
37 lv_anim_set_values(&a, 0, 10);
38 lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
39
40 lv_anim_set_exec_cb(&a, row_gap_anim);
41 lv_anim_set_time(&a, 500);
42 lv_anim_set_playback_time(&a, 500);
43 lv_anim_start(&a);
44
45 lv_anim_set_exec_cb(&a, column_gap_anim);
46 lv_anim_set_time(&a, 3000);
47 lv_anim_set_playback_time(&a, 3000);
48 lv_anim_start(&a);
49 }
50
51 #endif
52