1 #include "../../lv_examples.h"
2 #if LV_USE_LABEL && LV_BUILD_EXAMPLES
3 
4 /**
5  * Show customizing the circular scrolling animation of a label with `LV_LABEL_LONG_SCROLL_CIRCULAR`
6  * long mode.
7  */
lv_example_label_5(void)8 void lv_example_label_5(void)
9 {
10     static lv_anim_t animation_template;
11     static lv_style_t label_style;
12 
13     lv_anim_init(&animation_template);
14     lv_anim_set_delay(&animation_template, 1000);           /*Wait 1 second to start the first scroll*/
15     lv_anim_set_repeat_delay(&animation_template,
16                              3000);    /*Repeat the scroll 3 seconds after the label scrolls back to the initial position*/
17 
18     /*Initialize the label style with the animation template*/
19     lv_style_init(&label_style);
20     lv_style_set_anim(&label_style, &animation_template);
21 
22     lv_obj_t * label1 = lv_label_create(lv_scr_act());
23     lv_label_set_long_mode(label1, LV_LABEL_LONG_SCROLL_CIRCULAR);      /*Circular scroll*/
24     lv_obj_set_width(label1, 150);
25     lv_label_set_text(label1, "It is a circularly scrolling text. ");
26     lv_obj_align(label1, LV_ALIGN_CENTER, 0, 40);
27     lv_obj_add_style(label1, &label_style, LV_STATE_DEFAULT);           /*Add the style to the label*/
28 }
29 
30 #endif
31