lv_anim: add overshoot path

This commit is contained in:
Gabor Kiss-Vamosi
2018-11-20 14:49:16 +01:00
parent ee544893f6
commit 699f40c9b2
2 changed files with 31 additions and 0 deletions
+24
View File
@@ -196,6 +196,30 @@ int32_t lv_anim_path_ease_in_out(const lv_anim_t * a)
return new_value;
}
/**
* Calculate the current value of an animation with overshoot at the end
* @param a pointer to an animation
* @return the current value to set
*/
int32_t lv_anim_path_overshoot(const lv_anim_t * a)
{
/*Calculate the current step*/
uint32_t t;
if(a->time == a->act_time) t = 1024;
else t = (uint32_t)((uint32_t)a->act_time * 1024) / a->time;
int32_t step = lv_bezier3(t, 0, 600, 1300, 1024);
int32_t new_value;
new_value = (int32_t) step * (a->end - a->start);
new_value = new_value >> 10;
new_value += a->start;
return new_value;
}
/**
* Calculate the current value of an animation applying step characteristic.
* (Set end value on the end of the animation)
+7
View File
@@ -129,6 +129,13 @@ int32_t lv_anim_path_linear(const lv_anim_t *a);
*/
int32_t lv_anim_path_ease_in_out(const lv_anim_t *a);
/**
* Calculate the current value of an animation with overshoot at the end
* @param a pointer to an animation
* @return the current value to set
*/
int32_t lv_anim_path_overshoot(const lv_anim_t * a);
/**
* Calculate the current value of an animation applying step characteristic.
* (Set end value on the end of the animation)