summaryrefslogtreecommitdiff
path: root/src/animation.c
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2013-02-21 18:35:17 +0200
committerKristian Høgsberg <krh@bitplanet.net>2013-02-21 21:12:44 -0500
commitee4160544662c298102f2f7183ba5d3520da63ad (patch)
tree4c1182bd674ee40889f044d9acee4d78c1e2d7d7 /src/animation.c
parentcbdebc23707406958bc6132bcf585536266a5a3e (diff)
downloadweston-ee4160544662c298102f2f7183ba5d3520da63ad.tar.gz
animation: Make fade more controllable
Add parameters to weston_fade_run() for setting the initial and target values for the fade, as well as a parameter to set the spring constant used for the animation. Also add the weston_fade_update() function, that allows the animation to be changed while it is still running. This will be used to move the fade animation from core Weston into the shell. These changes are needed to be able to fade out as well as in, and to be able to reverse the fade in case of user input.
Diffstat (limited to 'src/animation.c')
-rw-r--r--src/animation.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/animation.c b/src/animation.c
index d141b373..147a5c03 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -239,10 +239,25 @@ fade_frame(struct weston_surface_animation *animation)
WL_EXPORT struct weston_surface_animation *
weston_fade_run(struct weston_surface *surface,
+ float start, float end, float k,
weston_surface_animation_done_func_t done, void *data)
{
- return weston_surface_animation_run(surface, 0, 0,
+ struct weston_surface_animation *fade;
+
+ fade = weston_surface_animation_run(surface, 0, 0,
fade_frame, done, data);
+
+ weston_spring_init(&fade->spring, k, start, end);
+ surface->alpha = start;
+
+ return fade;
+}
+
+WL_EXPORT void
+weston_fade_update(struct weston_surface_animation *fade,
+ float start, float end, float k)
+{
+ weston_spring_init(&fade->spring, k, start, end);
}
static void