1 /**
2  * @file lv_anim_timeline.h
3  *
4  */
5 
6 #ifndef LV_ANIM_TIMELINE_H
7 #define LV_ANIM_TIMELINE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "lv_anim.h"
17 
18 /*********************
19  *      DEFINES
20  *********************/
21 
22 /**********************
23  *      TYPEDEFS
24  **********************/
25 
26 struct _lv_anim_timeline_t;
27 
28 typedef struct _lv_anim_timeline_t lv_anim_timeline_t;
29 
30 /**********************
31 * GLOBAL PROTOTYPES
32 **********************/
33 
34 /**
35  * Create an animation timeline.
36  * @return pointer to the animation timeline.
37  */
38 lv_anim_timeline_t * lv_anim_timeline_create(void);
39 
40 /**
41  * Delete animation timeline.
42  * @param at    pointer to the animation timeline.
43  */
44 void lv_anim_timeline_del(lv_anim_timeline_t * at);
45 
46 /**
47  * Add animation to the animation timeline.
48  * @param at            pointer to the animation timeline.
49  * @param start_time    the time the animation started on the timeline, note that start_time will override the value of delay.
50  * @param a             pointer to an animation.
51  */
52 void lv_anim_timeline_add(lv_anim_timeline_t * at, uint32_t start_time, lv_anim_t * a);
53 
54 /**
55  * Start the animation timeline.
56  * @param at    pointer to the animation timeline.
57  * @return total time spent in animation timeline.
58  */
59 uint32_t lv_anim_timeline_start(lv_anim_timeline_t * at);
60 
61 /**
62  * Stop the animation timeline.
63  * @param at    pointer to the animation timeline.
64  */
65 void lv_anim_timeline_stop(lv_anim_timeline_t * at);
66 
67 /**
68  * Set the playback direction of the animation timeline.
69  * @param at        pointer to the animation timeline.
70  * @param reverse   whether to play in reverse.
71  */
72 void lv_anim_timeline_set_reverse(lv_anim_timeline_t * at, bool reverse);
73 
74 /**
75  * Set the progress of the animation timeline.
76  * @param at        pointer to the animation timeline.
77  * @param progress  set value 0~65535 to map 0~100% animation progress.
78  */
79 void lv_anim_timeline_set_progress(lv_anim_timeline_t * at, uint16_t progress);
80 
81 /**
82  * Get the time used to play the animation timeline.
83  * @param at    pointer to the animation timeline.
84  * @return total time spent in animation timeline.
85  */
86 uint32_t lv_anim_timeline_get_playtime(lv_anim_timeline_t * at);
87 
88 /**
89  * Get whether the animation timeline is played in reverse.
90  * @param at    pointer to the animation timeline.
91  * @return return true if it is reverse playback.
92  */
93 bool lv_anim_timeline_get_reverse(lv_anim_timeline_t * at);
94 
95 /**********************
96  *      MACROS
97  **********************/
98 
99 #ifdef __cplusplus
100 } /*extern "C"*/
101 #endif
102 
103 #endif /*LV_ANIM_TIMELINE_H*/
104