From a6cc194e6e8a6df417c890589c54d1e6b1966875 Mon Sep 17 00:00:00 2001 From: James Magahern Date: Sun, 20 Jan 2019 19:05:51 -0800 Subject: Red flash animation on bad password --- src/animation.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/animation.h') diff --git a/src/animation.h b/src/animation.h index 3064d1b..a74bb60 100644 --- a/src/animation.h +++ b/src/animation.h @@ -13,40 +13,47 @@ typedef double anim_time_interval_t; struct animation_t; typedef void(*AnimationCompletion)(struct animation_t *anim, void *context); +typedef enum { + IN, + OUT +} AnimationDirection; + typedef enum { _EmptyAnimationType, ACursorAnimation, ALogoAnimation, + ARedFlashAnimation, } AnimationType; typedef struct { - AnimationType type; - bool cursor_animating; double cursor_fade_direction; } CursorAnimation; typedef struct { - AnimationType type; - - bool direction; // false: in, true: out + AnimationDirection direction; } LogoAnimation; -typedef union { - AnimationType type; +typedef struct { + AnimationDirection direction; + unsigned flash_count; +} RedFlashAnimation; - CursorAnimation cursor_anim; - LogoAnimation logo_anim; +typedef union { + CursorAnimation cursor_anim; + LogoAnimation logo_anim; + RedFlashAnimation redflash_anim; } Animation; typedef struct { + AnimationType type; + Animation anim; + bool completed; anim_time_interval_t start_time; AnimationCompletion completion_func; void *completion_func_context; - - Animation anim; } animation_t; // Convenience: returns current time as anim_time_interval_t -- cgit v1.2.3-54-g00ecf