From 858c6c253253462790fb3e24ea0c311c87efd2cf Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Fri, 19 Jan 2024 16:33:54 -0500 Subject: [PATCH] Initial (terrible) commit --- include/hexagram/anim.h | 52 +++++++++++++++++++++++++++++++++++++++++ src/anim.c | 13 +++++++++++ 2 files changed, 65 insertions(+) create mode 100644 include/hexagram/anim.h create mode 100644 src/anim.c diff --git a/include/hexagram/anim.h b/include/hexagram/anim.h new file mode 100644 index 0000000..dbb3ceb --- /dev/null +++ b/include/hexagram/anim.h @@ -0,0 +1,52 @@ +#ifndef _HEXAGRAM_ANIM_H +#define _HEXAGRAM_ANIM_H + +#include +#include + +#include +#include + +typedef enum { + HEXAGRAM_ANIM_MOVE = 1 << 0, + HEXAGRAM_ANIM_ALPHA = 1 << 1, + HEXAGRAM_ANIM_RADIUS = 1 << 2 +} hexagram_anim_flags; + +typedef struct _hexagram_anim_action { + int flags; + + union { + hexagram_gauge *gauge; + hexagram_dial *dial; + }; + + struct { + struct { + double x, y; + }; + + double alpha; + double radius; + } from, to; +} hexagram_anim_action; + +typedef struct _hexagram_anim_stop { + hexagram_anim_action *actions; + size_t actionc; + double duration_s; +} hexagram_anim_stop; + +typedef struct _hexagram_anim { + hexagram_anim_stop *stops; + size_t count, current; + struct timeval start, now; +} hexagram_anim; + +void hexagram_anim_init(hexagram_anim *anim); + +int hexagram_anim_step(hexagram_anim *anim, cairo_t *bg, cairo_t *fg); + +double hexagram_anim_duration(hexagram_anim *anim); + +#endif /* _HEXAGRAM_ANIM_H */ diff --git a/src/anim.c b/src/anim.c new file mode 100644 index 0000000..b453fd1 --- /dev/null +++ b/src/anim.c @@ -0,0 +1,13 @@ +#include + +#include + +void hexagram_anim_init(hexagram_anim *anim) { + anim->current = 0; + + gettimeofday(&anim->start, NULL); +} + +int hexagram_anim_step(hexagram_anim *anim, cairo_t *bg, cairo_t *fg) { + +}