[gthumb/ext] [slideshow] added "cube from bottom" effect



commit 9433fa7e59ae729ae01fd38133f1b2ab37041b2f
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Fri Sep 4 08:40:36 2009 +0200

    [slideshow] added "cube from bottom" effect

 extensions/slideshow/main.c |   54 +++++++++++++++++++++++++++++++++++++++----
 1 files changed, 49 insertions(+), 5 deletions(-)
---
diff --git a/extensions/slideshow/main.c b/extensions/slideshow/main.c
index 6179d2f..0df9ce0 100644
--- a/extensions/slideshow/main.c
+++ b/extensions/slideshow/main.c
@@ -181,8 +181,8 @@ flip_transition (GthSlideshow *self,
 
 
 static void
-cube_transition (GthSlideshow *self,
-		 int           msecs)
+cube_from_right_transition (GthSlideshow *self,
+			    int           msecs)
 {
 	float stage_w, stage_h;
 
@@ -218,6 +218,44 @@ cube_transition (GthSlideshow *self,
 }
 
 
+static void
+cube_from_bottom_transition (GthSlideshow *self,
+			     int           msecs)
+{
+	float stage_w, stage_h;
+
+	clutter_actor_get_size (self->stage, &stage_w, &stage_h);
+
+	if (self->current_image != NULL) {
+		if (msecs >= GTH_TRANSITION_DURATION / 2)
+			clutter_actor_raise (self->next_image, self->current_image);
+		else
+			clutter_actor_raise (self->current_image, self->next_image);
+	}
+
+	clutter_actor_set_rotation (self->next_image,
+				    CLUTTER_X_AXIS,
+				    VALUE_AT_MSECS (90.0, msecs) + 270.0,
+				    0.0,
+				    0.0,
+				    - stage_w / 2.0);
+	if (self->current_image != NULL)
+		clutter_actor_set_rotation (self->current_image,
+					    CLUTTER_X_AXIS,
+					    VALUE_AT_MSECS (90.0, msecs),
+					    0.0,
+					    0.0,
+					    - stage_w / 2.0);
+
+	if (self->first_frame) {
+		if (self->current_image != NULL)
+			clutter_actor_move_anchor_point_from_gravity (self->current_image, CLUTTER_GRAVITY_CENTER);
+		clutter_actor_show (self->next_image);
+		clutter_actor_move_anchor_point_from_gravity (self->next_image, CLUTTER_GRAVITY_CENTER);
+	}
+}
+
+
 G_MODULE_EXPORT void
 gthumb_extension_activate (void)
 {
@@ -264,10 +302,16 @@ gthumb_extension_activate (void)
 				  "frame-func", flip_transition,
 				  NULL);
 	gth_main_register_object (GTH_TYPE_TRANSITION,
-				  "cube",
+				  "cube-from-right",
+				  GTH_TYPE_TRANSITION,
+				  "display-name", _("Cube from right"),
+				  "frame-func", cube_from_right_transition,
+				  NULL);
+	gth_main_register_object (GTH_TYPE_TRANSITION,
+				  "cube-from-bottom",
 				  GTH_TYPE_TRANSITION,
-				  "display-name", _("Cube"),
-				  "frame-func", cube_transition,
+				  "display-name", _("Cube from bottom"),
+				  "frame-func", cube_from_bottom_transition,
 				  NULL);
 
 	gth_hook_add_callback ("gth-browser-construct", 10, G_CALLBACK (ss__gth_browser_construct_cb), NULL);



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