aboutsummaryrefslogtreecommitdiff
path: root/src/animation.c
diff options
context:
space:
mode:
authorJames Magahern <james@magahern.com>2019-02-09 15:48:14 -0800
committerJames Magahern <james@magahern.com>2019-02-09 15:48:14 -0800
commit8dc7eb8b2fa9b6614cff27173cb556b4410ed6e2 (patch)
treebe2bd9d5d0f3f42f405bc403a9f50436899cf0c7 /src/animation.c
parentNeed to make sure to mark pw field as dirty when updating via xsl input too (diff)
Clean up the cursor animation a bit
Now the cursor won't start fading again until a short delay after the last keypress
Diffstat (limited to 'src/animation.c')
-rw-r--r--src/animation.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/animation.c b/src/animation.c
index 0ec403b..930c823 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -6,6 +6,7 @@
#include "animation.h"
#include <stdlib.h>
+#include <sys/param.h>
/*
* Easing functions
@@ -43,7 +44,7 @@ anim_time_interval_t anim_now()
double anim_progress_ease(animation_t *anim, const double duration, AnimationEasingFunc easing_f)
{
const anim_time_interval_t now = anim_now();
- double progress = (now - anim->start_time) / duration;
+ double progress = MAX(0.0, now - anim->start_time) / duration;
progress = easing_f(progress);
return (anim->direction == IN) ? progress : (1.0 - progress);