diff options
Diffstat (limited to 'src/animation.h')
-rw-r--r-- | src/animation.h | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/src/animation.h b/src/animation.h index 108fbe2..54adb70 100644 --- a/src/animation.h +++ b/src/animation.h @@ -26,20 +26,21 @@ typedef enum { ASpinnerAnimation, } AnimationType; +// Cursor flash animation typedef struct { - bool cursor_animating; - double cursor_fade_direction; + bool cursor_animating; } CursorAnimation; +// Logo transition in/out animation typedef struct { - AnimationDirection direction; } LogoAnimation; +// Red flash for incorrect password typedef struct { - AnimationDirection direction; unsigned flash_count; } RedFlashAnimation; +// Spinner shown when checking password typedef struct { double rotation; } SpinnerAnimation; @@ -58,13 +59,23 @@ typedef struct { bool completed; anim_time_interval_t start_time; + AnimationDirection direction; + AnimationCompletion completion_func; void *completion_func_context; } animation_t; -// Convenience: returns current time as anim_time_interval_t +// Convenience functions + +// returns current time as anim_time_interval_t anim_time_interval_t anim_now(); +// Returns normalized progress based on start time of `anim` and `duration` +double anim_progress(animation_t *anim, const double duration); + +// 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); |