mirror of
https://github.com/lvgl/lvgl.git
synced 2025-01-14 06:42:58 +08:00
Reduced animation callback interface calls
This commit is contained in:
parent
95ccd877a8
commit
437e6d35eb
@ -475,8 +475,11 @@ static void anim_task(lv_task_t * param)
|
||||
if(a->path.cb) new_value = a->path.cb(&a->path, a);
|
||||
else new_value = lv_anim_path_linear(&a->path, a);
|
||||
|
||||
if(new_value != a->current) {
|
||||
a->current = new_value;
|
||||
/*Apply the calculated value*/
|
||||
if(a->exec_cb) a->exec_cb(a->var, new_value);
|
||||
}
|
||||
|
||||
/*If the time is elapsed the animation is ready*/
|
||||
if(a->act_time >= a->time) {
|
||||
|
@ -82,6 +82,7 @@ typedef struct _lv_anim_t {
|
||||
lv_anim_ready_cb_t ready_cb; /**< Call it when the animation is ready*/
|
||||
lv_anim_path_t path; /**< Describe the path (curve) of animations*/
|
||||
int32_t start; /**< Start value*/
|
||||
int32_t current; /**< Current value */
|
||||
int32_t end; /**< End value*/
|
||||
int32_t time; /**< Animation time in ms*/
|
||||
int32_t act_time; /**< Current time in animation. Set to negative to make delay.*/
|
||||
@ -171,6 +172,7 @@ static inline void lv_anim_set_delay(lv_anim_t * a, uint32_t delay)
|
||||
static inline void lv_anim_set_values(lv_anim_t * a, lv_anim_value_t start, lv_anim_value_t end)
|
||||
{
|
||||
a->start = start;
|
||||
a->current = start;
|
||||
a->end = end;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user