From 1cfd406f9d40d6b39e4063e060b6c5114930f28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Mon, 17 Jun 2013 11:08:11 -0400 Subject: [PATCH] shell: Tweak spring animation for zoom animation type --- src/animation.c | 10 +++++++++- src/shell.c | 2 +- src/spring-tool.c | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/animation.c b/src/animation.c index a93d26e2..0b2fa95a 100644 --- a/src/animation.c +++ b/src/animation.c @@ -239,8 +239,16 @@ WL_EXPORT struct weston_surface_animation * weston_zoom_run(struct weston_surface *surface, float start, float stop, weston_surface_animation_done_func_t done, void *data) { - return weston_surface_animation_run(surface, start, stop, + struct weston_surface_animation *zoom; + + zoom = weston_surface_animation_run(surface, start, stop, zoom_frame, done, data); + + weston_spring_init(&zoom->spring, 300.0, start, stop); + zoom->spring.friction = 1400; + zoom->spring.previous = start - (stop - start) * 0.03; + + return zoom; } static void diff --git a/src/shell.c b/src/shell.c index 1522e991..ceb963cd 100644 --- a/src/shell.c +++ b/src/shell.c @@ -3459,7 +3459,7 @@ map(struct desktop_shell *shell, struct weston_surface *surface, weston_fade_run(surface, 0.0, 1.0, 300.0, NULL, NULL); break; case ANIMATION_ZOOM: - weston_zoom_run(surface, 0.8, 1.0, NULL, NULL); + weston_zoom_run(surface, 0.5, 1.0, NULL, NULL); break; default: break; diff --git a/src/spring-tool.c b/src/spring-tool.c index f2be7842..ba014776 100644 --- a/src/spring-tool.c +++ b/src/spring-tool.c @@ -42,7 +42,7 @@ int main(int argc, char *argv[]) { const double k = 300.0; - const double current = 0.0; + const double current = 0.5; const double target = 1.0; const double friction = 1400; @@ -51,7 +51,7 @@ main(int argc, char *argv[]) weston_spring_init(&spring, k, current, target); spring.friction = friction; - spring.previous = -0.03; + spring.previous = 0.48; spring.timestamp = 0; while (!weston_spring_done(&spring)) {