feat(anim) add anim timeline (#2309)

* add anim_timeline

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>

* add anim_timeline

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>

* add lv_anim_timeline.c to lv_misc.mk

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>

* LV_ANIM_TIMELINE_END uses global variables to replace macros, lv_anim_timeline_set_progress() adds user_data, act_time uses int32_t type

* solve the problem of uninitialized variable and act_time comparison

* add LV_ANIM_TIMELINE_CUSTOM_EXEC option

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>

* add LV_ANIM_TIMELINE_CUSTOM_EXEC in lv_conf_internal.h

* redesign lv_anim_timeline

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>

* add missing LV_USE_USER_DATA

* remove set_progress, update doc

* update workflow files

* Remove lv_example_anim_timeline_2.c and LV_ANIM_TIMELINE_CUSTOM_EXEC, update lv_anim_timeline_1.c example

Signed-off-by: FASTSHIFT <vifextech@foxmail.com>

* fix warning

Co-authored-by: Gabor Kiss-Vamosi <kisvegabor@gmail.com>
This commit is contained in:
_VIFEXTech
2021-07-19 19:58:58 +08:00
committed by GitHub
parent e5e93e24b4
commit 690b3546d6
10 changed files with 465 additions and 1 deletions

BIN
docs/misc/anim-timeline.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 85 KiB

View File

@@ -104,6 +104,28 @@ The speed is interpreted in _unit/sec_ dimension. For example, `lv_anim_speed_t
You can delete an animation with `lv_anim_del(var, func)` if you provide the animated variable and its animator function.
## Timeline
Timeline is a collection of multiple Animations, which makes it easy to create complex composite animations.
Firstly, create the animation element, but dont call `lv_anim_start()`.
Secondly, create an animation timeline object, by calling `lv_anim_timeline_create()`.
Thirdly, add animation elements to the animation timeline, by calling `lv_anim_timeline_add(at, start_time, &a)`. `start_time` is the start time of the animation on the timeline. Note that `start_time` will override the value of `delay`.
Finally, call `lv_anim_timeline_start(at)` to start the animation timeline.
It supports forward and backward playback of the entire animation group, using `lv_anim_timeline_set_reverse(at, reverse)`.
Call the `lv_anim_timeline_set_progress(at, progress)` function to set the state of the object corresponding to the progress of the timeline.
Call the `lv_anim_timeline_get_playtime(at)` function to get the total duration of the entire animation timeline.
Call the `lv_anim_timeline_get_reverse(at)` function to get whether to reverse the animation timeline.
Call the `lv_anim_timeline_del(at)` function to delete the animation timeline.
![](/misc/anim-timeline.png "timeline diagram")
## Examples