[glide] Reimplement zoom effect in Vala with options



commit d40c1e708d2ae1126823ef35960a91a0caabc535
Author: Robert Carr <racarr Valentine localdomain>
Date:   Wed Apr 28 03:41:51 2010 -0400

    Reimplement zoom effect in Vala with options

 src/glide-animation-manager.c  |    2 +-
 src/glide-vala-animations.vala |   53 +++++++++++++++++++++++++++++++++++++++-
 2 files changed, 53 insertions(+), 2 deletions(-)
---
diff --git a/src/glide-animation-manager.c b/src/glide-animation-manager.c
index 9ec986e..c0ac2a9 100644
--- a/src/glide-animation-manager.c
+++ b/src/glide-animation-manager.c
@@ -300,10 +300,10 @@ glide_animation_manager_register_animations ()
   glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_fade, NULL, "Fade");
   glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_fall, NULL, "Fall");
   glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_drop, NULL, "Drop");
-  glide_animation_manager_register_animation (glide_animations_animate_zoom, NULL, "Zoom");
   glide_animation_manager_register_animation (glide_animations_animate_zoom_contents, NULL, "Zoom Contents");
   glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_pivot, (GlideAnimationListOptionsCallback)glide_animate_pivot_list_options, "Pivot");
   glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_slide, (GlideAnimationListOptionsCallback)glide_animate_slide_list_options, "Slide");
+  glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_zoom, (GlideAnimationListOptionsCallback)glide_animate_zoom_list_options, "Zoom");
   glide_animation_manager_register_animation (glide_animations_animate_doorway, NULL, "Doorway");
 }
 
diff --git a/src/glide-vala-animations.vala b/src/glide-vala-animations.vala
index 28ba7a5..625eeb1 100644
--- a/src/glide-vala-animations.vala
+++ b/src/glide-vala-animations.vala
@@ -157,7 +157,6 @@ namespace Glide {
 		var timeline = new Clutter.Timeline(info.duration);
 		b.show_all();
 		a.raise (b);
-		a.depth = 1;
 		
 		animation_alpha = new Clutter.Alpha.full(timeline, Clutter.AnimationMode.EASE_IN_QUART);
 		timeline.new_frame.connect((m) => {
@@ -172,4 +171,56 @@ namespace Glide {
 
 		return timeline;
 	}
+	
+	public static
+	GLib.List animate_zoom_list_options (){
+		var ret = new GLib.List<string> ();
+		
+		ret.append ("Center");
+		ret.append ("Top Left");
+		ret.append ("Top Right");
+		ret.append ("Bottom Left");
+		ret.append ("Bottom Right");
+		
+		return ret;
+	}
+	
+	public static
+	Clutter.Timeline animate_zoom (AnimationInfo info,
+								   Clutter.Actor a,
+								   Clutter.Actor b)
+	{
+		var timeline = new Clutter.Timeline (info.duration);
+		
+		b.show_all();
+		
+		switch (info.option)
+		{
+		case "Center":
+			b.set_scale_full(0, 0, a.width / 2, a.height / 2);
+			break;
+		case "Top Left":
+			b.set_scale_full(0, 0, 0, 0);
+			break;
+		case "Top Right":
+			b.set_scale_full(0, 0, a.width, 0);
+			break;
+		case "Bottom Left":
+			b.set_scale_full(0, 0, 0, a.height);
+			break;
+		case "Bottom Right":
+			b.set_scale_full(0, 0, a.width, a.height);
+			break;
+		}
+		b.animate_with_timeline (Clutter.AnimationMode.EASE_OUT_SINE,
+								 timeline, "scale_x", 1.0,
+								 "scale_y", 1.0);
+		
+		timeline.completed.connect ((m) => {
+				a.hide_all ();
+			});
+		
+		return timeline;
+		
+	}
 }
\ No newline at end of file



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