aboutsummaryrefslogtreecommitdiff
path: root/src/animation.c
diff options
context:
space:
mode:
authorJames Magahern <james@magahern.com>2019-01-20 16:32:34 -0800
committerJames Magahern <james@magahern.com>2019-01-20 16:33:42 -0800
commit2f4561cb78c1f53ace26f56f28050d7b75c6414d (patch)
treeda4b6a15b0eeb6e518652dd3fb5c23ec80a1e911 /src/animation.c
parentAlso don't allow input in xsecurelock path (TODO: unify these) (diff)
Animation support. Logo animates in and out now
Diffstat (limited to 'src/animation.c')
-rw-r--r--src/animation.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/animation.c b/src/animation.c
new file mode 100644
index 0000000..15093d3
--- /dev/null
+++ b/src/animation.c
@@ -0,0 +1,34 @@
+/*
+ * animation.c
+ *
+ * Created by buzzert <buzzert@buzzert.net> 2019-01-20
+ */
+
+#include "animation.h"
+#include <stdlib.h>
+
+anim_time_interval_t anim_now()
+{
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+
+ long ms = (ts.tv_sec * 1000) + (ts.tv_nsec / 1000000);
+ return (ms / 1000.0);
+}
+
+/*
+ * Easing functions
+ */
+
+double anim_qubic_ease_out(double p)
+{
+ double f = (p - 1.0);
+ return (f * f * f) + 1;
+}
+
+double anim_quad_ease_out(double p)
+{
+ return -(p * (p - 2.0));
+}
+
+