From b7d2ea6bfa46b663452a4dc50a214f0690b712db Mon Sep 17 00:00:00 2001 From: XANTRONIX Development Date: Fri, 19 Jan 2024 21:31:12 -0500 Subject: [PATCH] Fuck it, let's try this --- src/anim.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/anim.c b/src/anim.c index e4158d3..c7c225e 100644 --- a/src/anim.c +++ b/src/anim.c @@ -31,7 +31,7 @@ static inline size_t stop_index(hexagram_anim *anim, double offset) { int hexagram_anim_step(hexagram_anim *anim, cairo_t *bg, cairo_t *fg) { struct timeval tv; double offset = 0.0, interval, progress; - size_t i; + size_t i, a; gettimeofday(&anim->now, NULL); @@ -63,5 +63,28 @@ int hexagram_anim_step(hexagram_anim *anim, cairo_t *bg, cairo_t *fg) { /* Determine current progress through current stop */ progress = (interval - offset) / anim->stops[i].duration; + for (a=0; astops[i].actionc; a++) { + hexagram_anim_action *action = &anim->stops[i].actions[a]; + + if (action->flags & HEXAGRAM_ANIM_MOVE) { + double x = progress * (action->to.x - action->from.x) + action->from.x, + y = progress * (action->to.y - action->from.y) + action->from.y; + + hexagram_gauge_move(action->gauge, x, y); + } + + if (action->flags & HEXAGRAM_ANIM_ALPHA) { + double alpha = progress * (action->to.alpha - action->from.alpha) + action->from.alpha; + + hexagram_gauge_set_alpha(action->gauge, alpha); + } + + if (action->flags & HEXAGRAM_ANIM_RADIUS) { + double radius = progress * (action->to.radius - action->from.radius) + action->from.radius; + + hexagram_dial_resize(action->dial, radius); + } + } + return 1; }