Lv_anim_timeline pause resume

I’m using esp32, arduino, developing with Visual Studio 2022 LVGL v9.2
I’ve recently been shown how to use animations and timeline.
It is a fantastic feature and I can now move an image around the screen.
My code works well, but I need to pause and continue the timeline.

Whilst you can pause a timeline with lv_anim_timeline_pause,
there doesn’t appear to be continue option.

If I start it again, I get a new image, and an image artefact on the screen.
Pause and restart a few times and it gets messy.

My code for the timeline is:-

lv_obj_t* supply_arrow;
lv_anim_timeline_t* supply_arrow_timeline;

void create_supply_arrow_anim(void)
{
// arrow object
//LV_IMG_DECLARE(arrows_down_25_25);
supply_arrow = lv_img_create(lv_scr_act());
//lv_obj_t* img2 = lv_img_create(lv_scr_act());
lv_img_set_src(supply_arrow, &arrows_down_25_25);
//lv_img_set_src(img2, &arrows_down_25_25);
lv_obj_set_size(supply_arrow, 150, 150);
//lv_obj_set_size(img2, 150, 150);
lv_obj_set_pos(supply_arrow, IMPORT_EXPORT_ARROW_X_POS, IMPORT_EXPORT_ARROW_Y_POS);
//lv_obj_set_pos(img2, IMPORT_EXPORT_ARROW_X_POS, IMPORT_EXPORT_ARROW_Y_POS + 100);
//lv_image_set_rotation(img2, 900);

//Arrow down
int arrow_finish_pos = IMPORT_EXPORT_ARROW_Y_POS + 90;
lv_anim_t a1;
lv_anim_init(&a1);
lv_anim_set_var(&a1, supply_arrow);
lv_anim_set_values(&a1, IMPORT_EXPORT_ARROW_Y_POS, arrow_finish_pos);
lv_anim_set_duration(&a1, 1000);
//lv_anim_set_repeat_delay(&a1, 50);
//lv_anim_set_repeat_count(&a1, LV_ANIM_REPEAT_INFINITE);
lv_anim_set_exec_cb(&a1, anim_y_cb);
//lv_anim_start(&a1);

//arrow rotate
lv_anim_t a2;
lv_anim_init(&a2);
lv_anim_set_var(&a2, supply_arrow);
lv_anim_set_values(&a2, 0, 900);
lv_anim_set_duration(&a2, 1000);
lv_anim_set_exec_cb(&a2, anim_r_cb);

//Arrow left
lv_anim_t a3;
lv_anim_init(&a3);
//lv_obj_set_pos(img1, 150, arrow_finish_pos+20);

lv_anim_set_var(&a3, supply_arrow);
lv_anim_set_values(&a3, 300, 100);
lv_anim_set_duration(&a3, 1000);
//lv_anim_set_repeat_delay(&a2, 50);
//lv_anim_set_repeat_count(&a2, LV_ANIM_REPEAT_INFINITE);
lv_anim_set_exec_cb(&a3, anim_x_cb);
//lv_anim_start(&a2);

//

//create animation timeline
supply_arrow_timeline = lv_anim_timeline_create();
lv_anim_timeline_add(supply_arrow_timeline, 0, &a1);
lv_anim_timeline_add(supply_arrow_timeline, 850, &a2);
lv_anim_timeline_add(supply_arrow_timeline, 1600, &a3);
lv_anim_timeline_start(supply_arrow_timeline);
//lv_anim_t* a = lv_anim_timeline_get_anim_progressing(supply_arrow_timeline);
//lv_anim_set_repeat_count(a, LV_ANIM_REPEAT_INFINITE);
//delay(2000);
//lv_anim_timeline_get lv_anim_timeline_get_progress(anim_timeline);
//lv_anim_timeline_pause(supply_arrow_timeline);
//delay(1000);
//lv_anim_timeline_start(anim_timeline);

}

void stop_supply_arrow_anim(void) {
lv_anim_timeline_pause(supply_arrow_timeline);

//supply_arrow = NULL;

}

void start_supply_arrow_anim(void) {
lv_anim_timeline_start(supply_arrow_timeline);
lv_anim_t* a = lv_anim_timeline_get_anim_progressing(supply_arrow_timeline);
lv_anim_set_repeat_count(a, LV_ANIM_REPEAT_INFINITE);
//supply_arrow = NULL;

}

I’ve tried using lv_anim_timeline_start.

I’ve tried

Important: unclear posts may not receive useful answers.

Before posting

  • Get familiar with Markdown to format and structure your post
  • Be sure to update lvgl from the latest version from the master branch.
  • Be sure you have checked the FAQ and read the relevant part of the documentation.
  • If applicable use the Simulator to eliminate hardware related issues.

Delete this section if you read and applied the mentioned points.

Description

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

Add a code snippet which can run in the simulator. It should contain only the relevant code that compiles without errors when separated from your main code base.

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.