Initial (terrible) commit

This commit is contained in:
XANTRONIX Development 2024-01-19 16:33:54 -05:00
parent 29943037d3
commit 858c6c2532
2 changed files with 65 additions and 0 deletions

52
include/hexagram/anim.h Normal file
View file

@ -0,0 +1,52 @@
#ifndef _HEXAGRAM_ANIM_H
#define _HEXAGRAM_ANIM_H
#include <sys/types.h>
#include <sys/time.h>
#include <hexagram/gauge.h>
#include <hexagram/dial.h>
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 */

13
src/anim.c Normal file
View file

@ -0,0 +1,13 @@
#include <stdlib.h>
#include <hexagram/anim.h>
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) {
}