Fuck it, let's try this

This commit is contained in:
XANTRONIX Development 2024-01-19 21:31:12 -05:00
parent 7a69d60a9d
commit b7d2ea6bfa

View file

@ -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; a<anim->stops[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;
}