[clutter/wip/apocalypses/apocalypse-6] actor: Add delay to the easing state



commit 8b8aa62a9cc1817bcc5b5718683145579ee010e6
Author: Emmanuele Bassi <ebassi linux intel com>
Date:   Thu Mar 15 12:24:02 2012 +0000

    actor: Add delay to the easing state
    
    It should be possible to set up the delay of a transition, but since
    we start the Transition instance before returning control to the caller,
    we cannot use clutter_actor_get_transition() to do it without something
    extra-awkward, like:
    
      transition = clutter_actor_get_transition (actor, "width");
      clutter_timeline_stop (transition);
      clutter_timeline_set_delay (transition, 1000);
      clutter_timeline_start (transition);
    
    for each property involved. It's much easier to add a delay to the
    easing state of an actor.

 clutter/clutter-actor-private.h            |    1 +
 clutter/clutter-actor.c                    |   60 ++++++++++++++++++++++++++++
 clutter/clutter-actor.h                    |    3 +
 clutter/clutter.symbols                    |    2 +
 doc/reference/clutter/clutter-sections.txt |   11 +++++
 5 files changed, 77 insertions(+), 0 deletions(-)
---
diff --git a/clutter/clutter-actor-private.h b/clutter/clutter-actor-private.h
index 32da6e0..2ef6aaa 100644
--- a/clutter/clutter-actor-private.h
+++ b/clutter/clutter-actor-private.h
@@ -213,6 +213,7 @@ ClutterTransformInfo *          _clutter_actor_get_transform_info
 
 typedef struct _AState {
   guint easing_duration;
+  guint easing_delay;
   ClutterAnimationMode easing_mode;
 } AState;
 
diff --git a/clutter/clutter-actor.c b/clutter/clutter-actor.c
index 19761cc..753def0 100644
--- a/clutter/clutter-actor.c
+++ b/clutter/clutter-actor.c
@@ -16764,6 +16764,8 @@ _clutter_actor_create_transition (ClutterActor *actor,
       clutter_transition_set_interval (res, interval);
       clutter_transition_set_remove_on_complete (res, TRUE);
 
+      clutter_timeline_set_delay (CLUTTER_TIMELINE (res),
+                                  info->cur_state->easing_delay);
       clutter_timeline_set_duration (CLUTTER_TIMELINE (res),
                                      info->cur_state->easing_duration);
       clutter_timeline_set_progress_mode (CLUTTER_TIMELINE (res),
@@ -16907,6 +16909,63 @@ clutter_actor_get_easing_mode (ClutterActor *self)
 }
 
 /**
+ * clutter_actor_set_easing_delay:
+ * @self: a #ClutterActor
+ * @msecs: the delay before the start of the tweening, in milliseconds
+ *
+ * Sets the delay that should be applied before tweening animatable
+ * properties.
+ *
+ * Calling this function will implicitly call
+ * clutter_actor_save_easing_state() if no previous calls to
+ * that function were made.
+ *
+ * Since: 1.10
+ */
+void
+clutter_actor_set_easing_delay (ClutterActor *self,
+                                guint         msecs)
+{
+  ClutterAnimationInfo *info;
+
+  g_return_if_fail (CLUTTER_IS_ACTOR (self));
+
+  info = _clutter_actor_get_animation_info (self);
+
+  if (info->states == NULL)
+    clutter_actor_save_easing_state (self);
+
+  if (info->cur_state->easing_delay != msecs)
+    info->cur_state->easing_delay = msecs;
+}
+
+/**
+ * clutter_actor_get_easing_delay:
+ * @self: a #ClutterActor
+ *
+ * Retrieves the delay that should be applied when tweening animatable
+ * properties.
+ *
+ * Return value: a delay, in milliseconds
+ *
+ * Since: 1.10
+ */
+guint
+clutter_actor_get_easing_delay (ClutterActor *self)
+{
+  const ClutterAnimationInfo *info;
+
+  g_return_val_if_fail (CLUTTER_IS_ACTOR (self), 0);
+
+  info = _clutter_actor_get_animation_info_or_defaults (self);
+
+  if (info->cur_state != NULL)
+    return info->cur_state->easing_delay;
+
+  return 0;
+}
+
+/**
  * clutter_actor_get_transition:
  * @self: a #ClutterActor
  * @name: the name of the transition
@@ -16977,6 +17036,7 @@ clutter_actor_save_easing_state (ClutterActor *self)
 
   new_state.easing_mode = CLUTTER_EASE_OUT_CUBIC;
   new_state.easing_duration = 250;
+  new_state.easing_delay = 0;
 
   g_array_append_val (info->states, new_state);
 
diff --git a/clutter/clutter-actor.h b/clutter/clutter-actor.h
index 3993a22..2e4bd18 100644
--- a/clutter/clutter-actor.h
+++ b/clutter/clutter-actor.h
@@ -651,6 +651,9 @@ ClutterAnimationMode            clutter_actor_get_easing_mode
 void                            clutter_actor_set_easing_duration               (ClutterActor               *self,
                                                                                  guint                       msecs);
 guint                           clutter_actor_get_easing_duration               (ClutterActor               *self);
+void                            clutter_actor_set_easing_delay                  (ClutterActor               *self,
+                                                                                 guint                       msecs);
+guint                           clutter_actor_get_easing_delay                  (ClutterActor               *self);
 ClutterTransition *             clutter_actor_get_transition                    (ClutterActor               *self,
                                                                                  const char                 *name);
 
diff --git a/clutter/clutter.symbols b/clutter/clutter.symbols
index 662ac14..d5748f2 100644
--- a/clutter/clutter.symbols
+++ b/clutter/clutter.symbols
@@ -92,6 +92,7 @@ clutter_actor_get_constraint
 clutter_actor_get_constraints
 clutter_actor_get_default_paint_volume
 clutter_actor_get_depth
+clutter_actor_get_easing_delay
 clutter_actor_get_easing_duration
 clutter_actor_get_easing_mode
 clutter_actor_get_effect
@@ -213,6 +214,7 @@ clutter_actor_set_child_at_index
 clutter_actor_set_clip
 clutter_actor_set_clip_to_allocation
 clutter_actor_set_depth
+clutter_actor_set_easing_delay
 clutter_actor_set_easing_duration
 clutter_actor_set_easing_mode
 clutter_actor_set_fixed_position_set
diff --git a/doc/reference/clutter/clutter-sections.txt b/doc/reference/clutter/clutter-sections.txt
index 413ebb6..c4c1cb2 100644
--- a/doc/reference/clutter/clutter-sections.txt
+++ b/doc/reference/clutter/clutter-sections.txt
@@ -455,6 +455,17 @@ clutter_actor_move_anchor_point
 clutter_actor_move_anchor_point_from_gravity
 
 <SUBSECTION>
+clutter_actor_save_easing_state
+clutter_actor_restore_easing_state
+clutter_actor_set_easing_duration
+clutter_actor_get_easing_duration
+clutter_actor_set_easing_mode
+clutter_actor_get_easing_mode
+clutter_actor_set_easing_delay
+clutter_actor_get_easing_delay
+clutter_actor_get_transition
+
+<SUBSECTION>
 clutter_actor_set_reactive
 clutter_actor_get_reactive
 clutter_actor_set_shader



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