shell: Tweak spring animation for zoom animation type

This commit is contained in:
Kristian Høgsberg 2013-06-17 11:08:11 -04:00
parent 8eb0f4f830
commit 1cfd406f9d
3 changed files with 12 additions and 4 deletions

View File

@ -239,8 +239,16 @@ WL_EXPORT struct weston_surface_animation *
weston_zoom_run(struct weston_surface *surface, float start, float stop, weston_zoom_run(struct weston_surface *surface, float start, float stop,
weston_surface_animation_done_func_t done, void *data) 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); 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 static void

View File

@ -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); weston_fade_run(surface, 0.0, 1.0, 300.0, NULL, NULL);
break; break;
case ANIMATION_ZOOM: case ANIMATION_ZOOM:
weston_zoom_run(surface, 0.8, 1.0, NULL, NULL); weston_zoom_run(surface, 0.5, 1.0, NULL, NULL);
break; break;
default: default:
break; break;

View File

@ -42,7 +42,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
const double k = 300.0; const double k = 300.0;
const double current = 0.0; const double current = 0.5;
const double target = 1.0; const double target = 1.0;
const double friction = 1400; const double friction = 1400;
@ -51,7 +51,7 @@ main(int argc, char *argv[])
weston_spring_init(&spring, k, current, target); weston_spring_init(&spring, k, current, target);
spring.friction = friction; spring.friction = friction;
spring.previous = -0.03; spring.previous = 0.48;
spring.timestamp = 0; spring.timestamp = 0;
while (!weston_spring_done(&spring)) { while (!weston_spring_done(&spring)) {