diff options
author | James Magahern <james@magahern.com> | 2019-01-27 22:45:02 -0800 |
---|---|---|
committer | James Magahern <james@magahern.com> | 2019-01-27 22:45:02 -0800 |
commit | bec575505537847cd8b128182bf9f81c7ac01319 (patch) | |
tree | f9d79c7aaebf65540f025996487da4018aa57c0f /src/animation.h | |
parent | Some code cleanup (diff) |
Animate with easing function
Diffstat (limited to 'src/animation.h')
-rw-r--r-- | src/animation.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/animation.h b/src/animation.h index 54adb70..e51771d 100644 --- a/src/animation.h +++ b/src/animation.h @@ -70,14 +70,17 @@ typedef struct { // returns current time as anim_time_interval_t anim_time_interval_t anim_now(); +// Easing functions +typedef double(*AnimationEasingFunc)(double in); +double anim_identity(double p); +double anim_qubic_ease_out(double p); +double anim_quad_ease_out(double p); + // Returns normalized progress based on start time of `anim` and `duration` double anim_progress(animation_t *anim, const double duration); +double anim_progress_ease(animation_t *anim, const double duration, AnimationEasingFunc easing_func); // Returns true if `anim` is complete depending on direction bool anim_complete(animation_t *anim, const double progress); -// Easing functions -double anim_qubic_ease_out(double p); -double anim_quad_ease_out(double p); - |