aboutsummaryrefslogtreecommitdiff
path: root/src/animate.h
diff options
context:
space:
mode:
authorFederico Angelilli <code@fedang.net>2024-03-14 23:42:39 +0100
committerFederico Angelilli <code@fedang.net>2024-03-14 23:42:39 +0100
commit5765bea99e1d497063ab312d879390b0dd3d2efd (patch)
tree474befd6fa140801c5d48ce857eb4dc2462616aa /src/animate.h
parent164a2559cbc9012194484fba767dcd127b36a993 (diff)
Add layout animations and refactor
Diffstat (limited to 'src/animate.h')
-rw-r--r--src/animate.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/animate.h b/src/animate.h
index c243287..a4ded33 100644
--- a/src/animate.h
+++ b/src/animate.h
@@ -9,20 +9,31 @@ typedef struct Animation Animation;
typedef struct State State;
typedef bool (* DrawFunc)(Animation *anim, cairo_t *cr, const Layout *layout);
+typedef bool (* LayoutFunc)(Animation *anim, Layout *layout);
struct Animation {
enum {
ANIM_SHINE,
+ ANIM_PULSE,
} type;
- DrawFunc paint;
+ DrawFunc paint_func;
+ LayoutFunc layout_func;
+ gint64 start;
+ gint64 duration;
};
+double clamp(double x, double min, double max);
+
+double smoothstep(double x, double edge0, double edge1);
+
double quadratic_bezier(double x, double a, double b, double c);
double cubic_bezier(double x, double a, double b, double c, double d);
Animation *animation_shine_create(gint64 duration);
+Animation *animation_pulse_create(gint64 duration);
+
void animation_destroy(Animation *anim);
#endif