aboutsummaryrefslogtreecommitdiff
path: root/src/animate.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/animate.c')
-rw-r--r--src/animate.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/animate.c b/src/animate.c
index 874dece..ca5cbfe 100644
--- a/src/animate.c
+++ b/src/animate.c
@@ -32,7 +32,6 @@ typedef struct {
Animation anim;
gint64 start;
gint64 duration;
- double x;
} AnimationShine;
bool shine_paint(AnimationShine *anim, cairo_t *cr, const Layout *layout)
@@ -42,15 +41,23 @@ bool shine_paint(AnimationShine *anim, cairo_t *cr, const Layout *layout)
anim->start = now;
gint64 end = anim->start + anim->duration;
- anim->x = 1.0;
+ double pos = 1.0;
if (now <= end) {
double t = (double)(now - anim->start) / (end - anim->start);
- anim->x = cubic_bezier(t, 0.19, 1.0, 0.22, 1.0);
+ pos = cubic_bezier(t, 0.19, 1.0, 0.22, 1.0);
}
- // Draw at x on the surface...
- return false;
+ int w = 10;
+ int x = layout->x + pos * layout->width - w;
+ int y = layout->y;
+
+ cairo_set_operator(cr, CAIRO_OPERATOR_OVER);
+ cairo_set_source_rgba(cr, 1, 1, 1, 0.1);
+ cairo_rectangle(cr, x, y, w, layout->height);
+ cairo_fill(cr);
+
+ return pos < 1.0;
}
Animation *animation_shine_create(gint64 duration)