[ease/animate_zoom: 3/6] Animate WelcomeActor repositioning.



commit 2ed54a7e88335356aadffeba24001256fb299aa8
Author: Nate Stedman <natesm gmail com>
Date:   Wed May 19 22:44:38 2010 -0400

    Animate WelcomeActor repositioning.

 src/libease/WelcomeActor.vala  |    4 ++++
 src/libease/WelcomeWindow.vala |   28 ++++++++++++++++++++++------
 2 files changed, 26 insertions(+), 6 deletions(-)
---
diff --git a/src/libease/WelcomeActor.vala b/src/libease/WelcomeActor.vala
index b001441..7e44aa7 100644
--- a/src/libease/WelcomeActor.vala
+++ b/src/libease/WelcomeActor.vala
@@ -28,6 +28,7 @@ public class Ease.WelcomeActor : Clutter.Rectangle
 	
 	// constants
 	private const int FADE_TIME = 200;
+	private const int FADE_INIT_TIME = 1000;
 	private const int FADE_EASE = Clutter.AnimationMode.EASE_IN_OUT_SINE;
 	private const int FADE_VALUE = 100;
 	
@@ -48,6 +49,9 @@ public class Ease.WelcomeActor : Clutter.Rectangle
 		set_border_color({255, 255, 255, 255});
 		set_border_width(2);
 		set_reactive(true);
+		
+		opacity = 0;
+		animate(FADE_EASE, FADE_INIT_TIME, "opacity", 255);
 	}
 	
 	public void clicked()
diff --git a/src/libease/WelcomeWindow.vala b/src/libease/WelcomeWindow.vala
index c9e3bac..0c6596c 100644
--- a/src/libease/WelcomeWindow.vala
+++ b/src/libease/WelcomeWindow.vala
@@ -61,6 +61,9 @@ public class Ease.WelcomeWindow : Gtk.Window
 	private const int RESOLUTION_COUNT = 5;
 	private const int PREVIEW_PADDING = 20;
 	
+	private const int ANIM_TIME = 75;
+	private const int ANIM_EASE = Clutter.AnimationMode.LINEAR;
+	
 	public WelcomeWindow()
 	{
 		title = "New Presentation";
@@ -228,13 +231,25 @@ public class Ease.WelcomeWindow : Gtk.Window
 		for (var i = 0; i < previews.size; i++)
 		{
 			// set the position of the preview
-			previews.get(i).x = x_origin + x_position * (PREVIEW_PADDING + preview_width);
-			previews.get(i).y = y_pixels;
+			WelcomeActor a = previews.get(i);
+			
+			if (a == null)
+			{
+				continue;
+			}
+
+			a.animate(ANIM_EASE, ANIM_TIME, "x",
+			          x_origin + x_position * (PREVIEW_PADDING + preview_width));
+
+			a.animate(ANIM_EASE, ANIM_TIME, "y", y_pixels);
 
 			// set the size of the preview
-			previews.get(i).width = preview_width;
-			previews.get(i).height = preview_width * preview_aspect;
-			
+			/*a.animate(ANIM_EASE, ANIM_TIME, "width", preview_width);
+			a.animate(ANIM_EASE, ANIM_TIME, "height",
+			         preview_width * preview_aspect);*/
+			a.width = preview_width;
+			a.height = preview_width * preview_aspect;
+
 			// go to the next line
 			if (++x_position >= per_line)
 			{
@@ -261,7 +276,8 @@ public class Ease.WelcomeWindow : Gtk.Window
 		var hbox = new Gtk.HBox(false, 5);
 		
 		// create zoom slider
-		zoom_slider = new Gtk.HScale(new Gtk.Adjustment(100, 100, 400, 10, 50, 50));
+		zoom_slider = new Gtk.HScale(new Gtk.Adjustment(100, 100, 400, 10,
+		                                                50, 50));
 		zoom_slider.width_request = 200;
 		zoom_slider.draw_value = false;
 		zoom_slider.digits = 0;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]