animation: Fix the fade animation to work in both directions

We'll use this for fading out windows.
dev
Kristian Høgsberg 11 years ago
parent 8404acb36f
commit 3a869019eb
  1. 10
      src/animation.c

@ -206,7 +206,7 @@ weston_view_animation_run(struct weston_view *view,
weston_matrix_init(&animation->transform.matrix); weston_matrix_init(&animation->transform.matrix);
wl_list_insert(&view->geometry.transformation_list, wl_list_insert(&view->geometry.transformation_list,
&animation->transform.link); &animation->transform.link);
weston_spring_init(&animation->spring, 200.0, 0.0, 1.0); weston_spring_init(&animation->spring, 200.0, start, stop);
animation->spring.friction = 700; animation->spring.friction = 700;
animation->animation.frame_counter = 0; animation->animation.frame_counter = 0;
animation->animation.frame = weston_view_animation_frame; animation->animation.frame = weston_view_animation_frame;
@ -290,17 +290,17 @@ weston_fade_run(struct weston_view *view,
{ {
struct weston_view_animation *fade; struct weston_view_animation *fade;
fade = weston_view_animation_run(view, 0, end, fade = weston_view_animation_run(view, start, end,
fade_frame, reset_alpha, fade_frame, reset_alpha,
done, data, NULL); done, data, NULL);
if (fade == NULL) if (fade == NULL)
return NULL; return NULL;
weston_spring_init(&fade->spring, k, start, end); fade->spring.k = 1000.0;
fade->spring.friction = 1400; fade->spring.friction = 4000;
fade->spring.previous = -(end - start) * 0.03; fade->spring.previous = start - (end - start) * 0.1;
view->alpha = start; view->alpha = start;

Loading…
Cancel
Save