[PATCH 1/2] animation: zoom: don't start animation with alpha set to 0

Rune K. Svendsen runesvend at gmail.com
Sat Feb 23 21:43:33 PST 2013


From: "Rune K. Svendsen" <runesvend at gmail.com>

I was doing some research on why I thought enabling the zoom/fade
animations added latency (a gap between releasing the launcher
button and the window appearing), and I found out that it's because,
for the first few frames, the alpha value is set to zero due to the
spring value being zero for the first few frames. This effectively
causes the first few frames to be invisible, and so, delays the
animation by about 20-30 ms. Making sure the alpha value has a
minimum value to begin with, makes opening new windows feel more
responsive when the animation is enabled.
---
 src/animation.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/animation.c b/src/animation.c
index 9e2ad4e..e86fda3 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -214,6 +214,9 @@ zoom_frame(struct weston_surface_animation *animation)
 				0.5f * es->geometry.height, 0);
 
 	es->alpha = animation->spring.current;
+	//starting with alpha set to 0 will cause the first frames to be invisible.
+	if (es->alpha < 0.3)
+		es->alpha = 0.3;
 	if (es->alpha > 1.0)
 		es->alpha = 1.0;
 }
-- 
1.7.10.4



More information about the wayland-devel mailing list