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 diff --git a/src/compositor.h b/src/compositor.h index a45fdf67..7cd6a6b6 100644 --- a/src/compositor.h +++ b/src/compositor.h @@ -820,7 +820,12 @@ weston_zoom_run(struct weston_surface *surface, float start, float stop, 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); +void +weston_fade_update(struct weston_surface_animation *fade, + float start, float end, float k); + struct weston_surface_animation * weston_slide_run(struct weston_surface *surface, float start, float stop, weston_surface_animation_done_func_t done, void *data); diff --git a/src/shell.c b/src/shell.c index a4511fd4..da17cfbd 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3026,7 +3026,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface, { switch (shell->win_animation_type) { case ANIMATION_FADE: - weston_fade_run(surface, NULL, NULL); + weston_fade_run(surface, 0.0, 1.0, 200.0, NULL, NULL); break; case ANIMATION_ZOOM: weston_zoom_run(surface, 0.8, 1.0, NULL, NULL);