]> err.no Git - libchamplain/commitdiff
Port animations to the new API
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Sat, 16 May 2009 22:31:10 +0000 (18:31 -0400)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Mon, 3 Aug 2009 22:16:09 +0000 (18:16 -0400)
champlain/champlain-tile.c
champlain/champlain-view.c

index 1497c102e0af4d25acff1f1052fb101a619a554a..5bab7c59ea3ab44aebfec717260af182d9aed24a 100644 (file)
@@ -826,31 +826,26 @@ champlain_tile_set_etag (ChamplainTile *self,
 
 typedef struct {
   ChamplainTile *tile;
-  //ClutterEffectTemplate *etemplate;
-  ClutterTimeline *timeline;
   ClutterActor *old_actor;
 } AnimationContext;
-/*
+
 static void
-fade_in_completed (ClutterTimeline *timeline,
+fade_in_completed (ClutterAnimation *animation,
     gpointer data)
 {
   AnimationContext* ctx = (AnimationContext*) data;
   ChamplainTilePrivate *priv = GET_PRIVATE (ctx->tile);
 
   if (ctx->old_actor != NULL)
-  {
-    g_object_unref (ctx->old_actor);
-    clutter_container_remove (CLUTTER_CONTAINER (priv->actor), ctx->old_actor, NULL);
-  }
+    {
+      g_object_unref (ctx->old_actor);
+      clutter_container_remove (CLUTTER_CONTAINER (priv->actor), ctx->old_actor, NULL);
+    }
 
   g_object_unref (ctx->tile);
-  g_object_unref (ctx->timeline);
-  //g_object_unref (ctx->etemplate);
   g_free (ctx);
-
 }
-*/
+
 
 /**
  * champlain_tile_set_content:
@@ -884,21 +879,20 @@ champlain_tile_set_content (ChamplainTile *self,
 
   clutter_container_add (CLUTTER_CONTAINER (priv->actor), actor, NULL);
 
-  /* fixme: etemplate are leaked here 
+  /* fixme: etemplate are leaked here */
   if (fade_in == TRUE)
     {
+      ClutterAnimation *animation;
+      clutter_actor_set_opacity (actor, 0);
+
       AnimationContext *ctx = g_new0 (AnimationContext, 1);
       ctx->tile = g_object_ref (self);
-      ctx->timeline = clutter_timeline_new_for_duration (750);
-      ctx->etemplate = clutter_effect_template_new (ctx->timeline, CLUTTER_ALPHA_SINE_INC);
+      animation = clutter_actor_animate (actor, CLUTTER_EASE_IN_CUBIC,
+          500, "opacity", 255, NULL);
       ctx->old_actor = old_actor;
 
-      g_signal_connect (ctx->timeline, "completed", G_CALLBACK (fade_in_completed), ctx);
-
-      clutter_actor_set_opacity (actor, 0);
-      clutter_effect_fade (ctx->etemplate, actor, 255, NULL, NULL);
+      g_signal_connect (animation, "completed", G_CALLBACK (fade_in_completed), ctx);
     }
-  */
 
   priv->content_actor = g_object_ref (actor);
   g_object_notify (G_OBJECT (self), "content");
index fddc7602ae6691caba8b70387bc8b5569472a21d..1149ad2d8338ec300c4851f7462112082fdec173 100644 (file)
@@ -1374,7 +1374,7 @@ champlain_view_go_to (ChamplainView *view,
    */
   duration = 500 * priv->zoom_level / 2.0;
   ctx->timeline = clutter_timeline_new_for_duration (duration);
-  ctx->alpha = clutter_alpha_new_full (ctx->timeline, CLUTTER_EASE_OUT_SINE);
+  ctx->alpha = clutter_alpha_new_full (ctx->timeline, CLUTTER_EASE_IN_OUT_CIRC);
 
   g_signal_connect (ctx->timeline, "new-frame", G_CALLBACK (timeline_new_frame),
       ctx);