init Files
This commit is contained in:
51
libraries/lvgl/examples/layouts/flex/lv_example_flex_5.c
Normal file
51
libraries/lvgl/examples/layouts/flex/lv_example_flex_5.c
Normal file
@@ -0,0 +1,51 @@
|
||||
#include "../../lv_examples.h"
|
||||
#if LV_USE_FLEX && LV_BUILD_EXAMPLES
|
||||
|
||||
static void row_gap_anim(void * obj, int32_t v)
|
||||
{
|
||||
lv_obj_set_style_pad_row(obj, v, 0);
|
||||
}
|
||||
|
||||
static void column_gap_anim(void * obj, int32_t v)
|
||||
{
|
||||
lv_obj_set_style_pad_column(obj, v, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Demonstrate the effect of column and row gap style properties
|
||||
*/
|
||||
void lv_example_flex_5(void)
|
||||
{
|
||||
lv_obj_t * cont = lv_obj_create(lv_screen_active());
|
||||
lv_obj_set_size(cont, 300, 220);
|
||||
lv_obj_center(cont);
|
||||
lv_obj_set_flex_flow(cont, LV_FLEX_FLOW_ROW_WRAP);
|
||||
|
||||
uint32_t i;
|
||||
for(i = 0; i < 9; i++) {
|
||||
lv_obj_t * obj = lv_obj_create(cont);
|
||||
lv_obj_set_size(obj, 70, LV_SIZE_CONTENT);
|
||||
|
||||
lv_obj_t * label = lv_label_create(obj);
|
||||
lv_label_set_text_fmt(label, "%"LV_PRIu32, i);
|
||||
lv_obj_center(label);
|
||||
}
|
||||
|
||||
lv_anim_t a;
|
||||
lv_anim_init(&a);
|
||||
lv_anim_set_var(&a, cont);
|
||||
lv_anim_set_values(&a, 0, 10);
|
||||
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
|
||||
|
||||
lv_anim_set_exec_cb(&a, row_gap_anim);
|
||||
lv_anim_set_duration(&a, 500);
|
||||
lv_anim_set_playback_duration(&a, 500);
|
||||
lv_anim_start(&a);
|
||||
|
||||
lv_anim_set_exec_cb(&a, column_gap_anim);
|
||||
lv_anim_set_duration(&a, 3000);
|
||||
lv_anim_set_playback_duration(&a, 3000);
|
||||
lv_anim_start(&a);
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user