[glide] Some more vala animations



commit 324a4e25e82f45bb30a4d84a7f6892cc2663419f
Author: Robert Carr <racarr Valentine localdomain>
Date:   Tue Apr 27 20:44:14 2010 -0400

    Some more vala animations

 src/glide-animation-manager.c  |    8 ++--
 src/glide-vala-animations.vala |   76 ++++++++++++++++++++++++++++++++++++++-
 2 files changed, 78 insertions(+), 6 deletions(-)
---
diff --git a/src/glide-animation-manager.c b/src/glide-animation-manager.c
index 20267e9..4437887 100644
--- a/src/glide-animation-manager.c
+++ b/src/glide-animation-manager.c
@@ -298,10 +298,10 @@ void
 glide_animation_manager_register_animations ()
 {
   glide_animation_manager_register_animation ((GlideAnimationCallback)glide_animate_fade, NULL, "Fade");
-  glide_animation_manager_register_animation (glide_animations_animate_drop, NULL, "Drop");
+  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 (glide_animations_animate_pivot, NULL, "Pivot");
+  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 (glide_animations_animate_doorway, NULL, "Doorway");
 }
@@ -309,8 +309,8 @@ glide_animation_manager_register_animations ()
 void
 glide_animation_manager_free_options (GList *l)
 {
-  GList *t = l;
-  for (t; t; t = t->next)
+  GList *t;
+  for (t = l; t; t = t->next)
     {
       g_free (t->data);
     }
diff --git a/src/glide-vala-animations.vala b/src/glide-vala-animations.vala
index 99e389a..3c657d0 100644
--- a/src/glide-vala-animations.vala
+++ b/src/glide-vala-animations.vala
@@ -14,7 +14,7 @@ namespace Glide {
 				
 		timeline.completed.connect((t) => {
 				a.opacity = 0xff;
-				a.hide();
+				a.hide_all();
 			});	
 		
 		return timeline;
@@ -67,7 +67,7 @@ namespace Glide {
 		}
 		
 		timeline.completed.connect ((t) => {
-				a.hide();
+				a.hide_all();
 				a.x = a.y = 0;
 			});
 		
@@ -75,5 +75,77 @@ namespace Glide {
 
 	}
 	
+	public static
+	Clutter.Timeline animate_drop (AnimationInfo info,
+								   Clutter.Actor a,
+								   Clutter.Actor b){
+		var timeline = new Clutter.Timeline(info.duration);
+
+		b.show_all();
+		b.y = -a.height;
+		b.animate_with_timeline(Clutter.AnimationMode.EASE_OUT_BOUNCE, timeline, "y", 0.0);
+		
+		timeline.completed.connect ((t) => {
+				a.hide_all();
+			});
+		
+		return timeline;
+	}
+	
+	public static
+	GLib.List animate_pivot_list_options (){
+		var ret = new GLib.List<string> ();
+		
+		ret.append("Top Right");
+		ret.append("Bottom Left");
+		ret.append("Bottom Right");
+		
+		return ret;
+	}
+	
+	public static
+	Clutter.Timeline animate_pivot (AnimationInfo info,
+									Clutter.Actor a,
+									Clutter.Actor b)
+	{
+		Clutter.Alpha animation_alpha;
+		var timeline = new Clutter.Timeline (info.duration);
+		float xpos = 0, ypos = 0, angle = 90;
+		
+		b.show_all();
+		
+		switch (info.option)
+		{
+		case "Top Right":
+			xpos = a.width;
+			angle = -90;
+			break;
+		case "Bottom Left":
+			ypos = a.height;
+			angle = -90;
+			break;
+		case "Bottom Right":
+			xpos = a.width;
+			ypos = a.height;
+			break;
+		}
+		b.set_rotation (Clutter.RotateAxis.Z_AXIS, angle, xpos, ypos, 0);
+		
+		animation_alpha = new Clutter.Alpha.full (timeline, Clutter.AnimationMode.EASE_OUT_SINE);
+		timeline.new_frame.connect((m) => {
+				b.set_rotation (Clutter.RotateAxis.Z_AXIS,
+								angle * (1-animation_alpha.alpha),
+								xpos, ypos, 0);
+			});
+		timeline.completed.connect((m) => {
+				a.hide_all();
+			});
+		
+		timeline.start ();
+		
+		return timeline;
+		
+	}
+	
 	
 }
\ No newline at end of file



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