cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=a3c7a831960e679d36b6c1fa443fc9642c243914

commit a3c7a831960e679d36b6c1fa443fc9642c243914
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Mon Jun 22 18:46:12 2015 +0200

    edje: add possibility to speed up animation per object.
    
    This could come handy for previewing the effect of accelerating animation.
    
    @feature
---
 src/lib/edje/Edje_Common.h  |  4 ++--
 src/lib/edje/edje_object.eo | 23 +++++++++++++++++++++++
 src/lib/edje/edje_private.h |  2 ++
 src/lib/edje/edje_program.c | 15 ++++++++++++++-
 src/lib/edje/edje_smart.c   |  1 +
 5 files changed, 42 insertions(+), 3 deletions(-)

diff --git a/src/lib/edje/Edje_Common.h b/src/lib/edje/Edje_Common.h
index 7e33765..7daec09 100644
--- a/src/lib/edje/Edje_Common.h
+++ b/src/lib/edje/Edje_Common.h
@@ -1834,7 +1834,7 @@ EAPI void         edje_thaw                       (void);
 EAPI void         edje_language_set               (const char *locale);
 
 /**
- * @brief Set edje trasition's duration factor.
+ * @brief Set edje transition duration factor.
  *
  * @param scale The edje trasition's duration factor (the default value is @c 
1.0)
  *
@@ -1857,7 +1857,7 @@ EAPI void         edje_language_set               (const 
char *locale);
 EAPI void         edje_transition_duration_factor_set        (double scale);
 
 /**
- * @brief Retrieve trasitions'duration factor.
+ * @brief Retrieve transitions duration factor.
  *
  * @return The edje transition duration factor
  *
diff --git a/src/lib/edje/edje_object.eo b/src/lib/edje/edje_object.eo
index c1e18cd..9cd3e81 100755
--- a/src/lib/edje/edje_object.eo
+++ b/src/lib/edje/edje_object.eo
@@ -2384,6 +2384,29 @@ class Edje.Object (Evas.Smart_Clipped, Efl.File)
             @in obj_swallow: Evas.Object *; /*@ The object to occupy that part 
*/
          }
       }
+      @property transition_duration_factor {
+         set {
+            /*@
+              @brief Set transition duration factor.
+
+              This define the transition duration factor on this
+              specific object. By default all animation are run at a speed
+              factor of 1.0.
+             */
+         }
+         get {
+            /*@
+              @brief Get transition duration factor.
+
+              This define the transition duration factor on this
+              specific object. By default all animation are run at a speed
+              factor of 1.0.
+             */
+         }
+         values {
+            scale: double; /*@ The transition duration factor */
+         }
+      }
    }
    implements {
       Eo.Base.constructor;
diff --git a/src/lib/edje/edje_private.h b/src/lib/edje/edje_private.h
index d69a783..44c8be7 100644
--- a/src/lib/edje/edje_private.h
+++ b/src/lib/edje/edje_private.h
@@ -1573,6 +1573,8 @@ struct _Edje
    EPhysics_World       *world;
 #endif
 
+   double                duration_scale;
+
    Eina_List            *user_defined;
 
    lua_State            *L;
diff --git a/src/lib/edje/edje_program.c b/src/lib/edje/edje_program.c
index 9947f44..bf719a0 100644
--- a/src/lib/edje/edje_program.c
+++ b/src/lib/edje/edje_program.c
@@ -195,6 +195,19 @@ edje_transition_duration_factor_set(double scale)
    _edje_transition_duration_scale = FROM_DOUBLE(scale);
 }
 
+EOLIAN void
+_edje_object_transition_duration_factor_set(Eo *obj EINA_UNUSED,
+                                            Edje *pd, double scale)
+{
+   pd->duration_scale = scale;
+}
+
+EOLIAN double
+_edje_object_transition_duration_factor_get(Eo *obj EINA_UNUSED, Edje *pd)
+{
+   return pd->duration_scale;
+}
+
 void
 edje_object_propagate_callback_add(Evas_Object *obj, void (*func)(void *data, 
Evas_Object *o, const char *emission, const char *source), void *data)
 {
@@ -412,7 +425,7 @@ _edje_object_animation_get(Eo *obj EINA_UNUSED, Edje *ed)
 Eina_Bool
 _edje_program_run_iterate(Edje_Running_Program *runp, double tim)
 {
-   FLOAT_T t, total, t_scale = 1.0;
+   FLOAT_T t, total, t_scale = runp->edje->duration_scale;
    Eina_List *l;
    Edje *ed;
    Edje_Program_Target *pt;
diff --git a/src/lib/edje/edje_smart.c b/src/lib/edje/edje_smart.c
index 225db1a..5bd5ce2 100644
--- a/src/lib/edje/edje_smart.c
+++ b/src/lib/edje/edje_smart.c
@@ -28,6 +28,7 @@ EOLIAN static Eo *
 _edje_object_eo_base_constructor(Eo *obj, Edje *ed)
 {
    ed->base = eo_data_ref(obj, EVAS_SMART_CLIPPED_CLASS);
+   ed->duration_scale = 1.0;
 
    obj = eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
    eo_do(obj, evas_obj_type_set(MY_CLASS_NAME_LEGACY));

-- 


Reply via email to