How to loop/repeat animation timeline indefinitely?

Description

I am currently working on an application that needs animation timelines to run indefinitely similar to the lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE ) for a standard animation. Is this possible?

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

ESP32

What LVGL version are you using?

v9.1.1-dev

What do you want to achieve?

An infinitely repeating animation timeline

What have you tried so far?

I’ve tried setting all of the animations within the timeline to loop indefinitely, but that doesn’t seem to work. I’ve also tried tracking the progress of the timeline in a loop and as soon as the animation timeline gets to the end, the animation timeline is deleted, recreated, and started again. This works somewhat, but it crashes after a few iterations.

The anim_timeline now does not support lv_anim_set_repeat_count(...).

I came across a similar situation with v8.x and ended up using a “manual” approach to the timeline feature. I lv_anim_set_delay to the total animation cycle time to the total time and lv_anim_set_delay to be the starting time of each specific animation to the first.

This allows you to set all animations to LV_ANIM_REPEAT_INFINITE and they should behave as a “timeline”

If you want the animation timeline to run repeatedly,
add function lv_anim_timeline_get_anim_progressing(...)
to lv_anim_timeline.h and lv_anim_timeline.c
as follows:

and your code after call lv_anim_timeline_start(..)
add the code :

  lv_anim_timeline_start(timeline);  // start your anim timeline

  // set anim progressing of anim timeline to LV_ANIM_REPEAT_INFINITE
  lv_anim_t* a = lv_anim_timeline_get_anim_progressing(timeline);
  lv_anim_set_repeat_count(a, LV_ANIM_REPEAT_INFINITE);

2 Likes

This looks a lot like a PR =P

However, given that the timeline has its own set of functions a lv_anim_timeline_set_repeat_count might be in order. This would basically implement what you suggested.