How can I scroll the text to the end, and make a transition to another text


how can I scroll the text to the end, and make a transition to another text

What MCU/Processor/Board and compiler are you using?


What LVGL version are you using?


What do you want to achieve?

What have you tried so far?

Code to reproduce

for example

    lv_obj_t * label1 = lv_label_create(lv_scr_act(), NULL);
	lv_label_set_long_mode(label1, LV_LABEL_LONG_SROLL);/*Circular scroll*/
	lv_label_set_recolor(label1, true);                      /*Enable re-coloring by commands in the text*/
	lv_label_set_text(label1,"aaaaaaaaaaaaaaaa veryyyyyyyyyyyyyyyy loooooooooooooooooooog teeeeeeeeeeeeeeeeeext");
	lv_obj_align(label1, NULL, LV_ALIGN_CENTER, x_pos, y_pos);

    if(long_text(here it seems to me there should be a variable that returns the end in scroll mode) == end ){

someone have ideas?


You can do it like this:

void ready_cb(lv_anim_t * a)
    lv_obj_t * label = a->var;
    lv_label_set_text(label, "New text");
    lv_obj_set_pos(label, 0, 0);


  lv_obj_t * box = lv_obj_create(lv_scr_act(), NULL);
  lv_obj_set_pos(box, 10, 10);

  lv_obj_t * label = lv_label_create(box, NULL);
  lv_label_set_text(label, "A veryyyyyy loooooooong teeeeeeeext");

  lv_anim_t a;
  lv_anim_set_var(&a, label);
  lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
  lv_anim_set_time(&a, 3000);
  lv_anim_set_values(&a, 0, - lv_obj_get_width(label) + lv_obj_get_width(box));
  lv_anim_set_ready_cb(&a, ready_cb);

thank you)