How to customize the circular scrolling of a label?


I need to set up a label with long mode LV_LABEL_LONG_SCROLL_CIRCULAR but I need to customize the animation parameters, namely the animation speed, the start delay and the repeat delay.

I’m pretty sure that customizing that is not possible as of LVGL 8.1. Does anybody have any idea how to achieve that?

I tried to copy the relevant animation code from lv_label_refr_text(), replicate the animation setup, and
set long mode to LV_LABEL_LONG_CLIP so that the animation is ignored in lv_label_refr_text(), but it seems that long mode needs to be LV_LABEL_LONG_SCROLL_CIRCULAR in order to draw the label correctly.

If this sort of customization is not possible right now, I’d appreciate some guidance to implement this feature myself and I’ll create a PR so that it’s hopefully included in 8.2.

Thanks for your help.

voidlv_label_set_anim_speed (lv_obj_t*label, uint16_tanim_speed )

Set the label’s animation speed in LV_LABEL_LONG_SROLL/SROLL_CIRC modes


  • label – pointer to a label object
  • anim_speed – speed of animation in px/sec unit

oops this is in V7…i dont see in V8

1 Like

Ah too bad, why was this functionality removed?

Bumping this up. Still need feedback on this :slight_smile:

lv_obj_set_style_anim_speed(label, anim_speed, LV_PART_MAIN) should work. A lot of functions were genericized in v8 so they’re no longer object-specific.

1 Like

What about the start delay and the repeat delay?

That is hardcoded now, unfortunately.

So if I wanted to submit a PR to make it adjustable, what would I need to do?

Should I create lv_obj_set_style_anim_start_delay() and lv_obj_set_style_anim_repeat_delay()?

(cc @kisvegabor)

It would be nice to make it adjustable, but in v8.2 we only have space for 5 more built-in properties before we’ll run out. I’m not sure how to proceed.

You would need to add the property in scripts/, and then run that script. That will generate all the helper functions automatically. Then, you’d need to update lv_label.c to use the property instead of the hardcoded value.

1 Like

So, should I try and go down this route @kisvegabor? Adding two new style properties?

I think you mean LV_LABEL_LONG_SCROLL because there are no delay properties in case of LV_LABEL_LONG_SCROLL_CIRCULAR.

Adding e.g. lv_obj_set_style_anim_repeat_delay might solve this problem but maybe someone will miss e.g. the anim_path for lv_bar animation next time. So what about this?

lv_obj_set_style_anim(lv_obj_t * obj, const lv_anim_t * anim, ...)

where anim would be used as a template animation. This way you can’t change only path or time but only the whole animation at once.

What do you think?

This is what I want to achieve:

I need a circular scrolling label, which starts scrolling 3 seconds after initially shown, then when the label has scrolled all the way back to its initial position, it should repeat the circular scrolling animation every 10 seconds.

So I think that would be start_delay and repeat_delay respectively.

I see now and it makes a lot of sense.

I still believe passing a whole animation structure is the most flexible option. Do you have time/interest to contribute with this feature? If you feel free to open an issue or send a Pull request on GitHub to discuss the details.

Yes I can try to implement this, but I’d definitely need some guidance :slight_smile:

If you can tell me what to do and where to start I can probably do this.

I opened a new issue on GitHub.

Thank you!