bu5hm4n pushed a commit to branch master.

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

commit a29be18b5f6f94d8b4e6e7738ced1ae502159fbc
Author: Marcel Hollerbach <[email protected]>
Date:   Wed Dec 4 10:14:09 2019 +0100

    efl_canvas_animation: add a standard value for duration of animations
    
    before this commit the standard time was 0, which results in no
    animation played at all. Now its 0.2 and a app that does not like it can
    adjust it.
    
    ref T8436
    
    Reviewed-by: Xavi Artigas <[email protected]>
    Differential Revision: https://phab.enlightenment.org/D10796
---
 src/lib/evas/canvas/efl_canvas_animation.c  | 22 ++++++++++++++++++++++
 src/lib/evas/canvas/efl_canvas_animation.eo |  9 +++++++++
 src/tests/evas/efl_canvas_animation.c       |  9 +++++++++
 3 files changed, 40 insertions(+)

diff --git a/src/lib/evas/canvas/efl_canvas_animation.c 
b/src/lib/evas/canvas/efl_canvas_animation.c
index 33ffa035ac..772fb41b18 100644
--- a/src/lib/evas/canvas/efl_canvas_animation.c
+++ b/src/lib/evas/canvas/efl_canvas_animation.c
@@ -2,6 +2,8 @@
 
 #define MY_CLASS EFL_CANVAS_ANIMATION_CLASS
 
+static double _default_animation_time = 0.2; //in seconds
+
 EOLIAN static void
 _efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED,
                             Efl_Canvas_Animation_Data *pd,
@@ -134,4 +136,24 @@ _efl_canvas_animation_efl_playable_seekable_get(const Eo 
*eo_obj EINA_UNUSED, Ef
    return EINA_TRUE;
 }
 
+EOLIAN static Efl_Object*
+_efl_canvas_animation_efl_object_constructor(Eo *obj, 
Efl_Canvas_Animation_Data *pd)
+{
+   pd->duration = _default_animation_time;
+   return efl_constructor(efl_super(obj, MY_CLASS));
+}
+
+EOLIAN static void
+_efl_canvas_animation_default_duration_set(double animation_time)
+{
+   EINA_SAFETY_ON_FALSE_RETURN(animation_time > 0.0);
+   _default_animation_time = animation_time;
+}
+
+EOLIAN static double
+_efl_canvas_animation_default_duration_get(void)
+{
+   return _default_animation_time;
+}
+
 #include "efl_canvas_animation.eo.c"
diff --git a/src/lib/evas/canvas/efl_canvas_animation.eo 
b/src/lib/evas/canvas/efl_canvas_animation.eo
index 3640cd2234..a55cf73bbd 100644
--- a/src/lib/evas/canvas/efl_canvas_animation.eo
+++ b/src/lib/evas/canvas/efl_canvas_animation.eo
@@ -110,8 +110,17 @@ class @beta Efl.Canvas.Animation extends Efl.Object 
implements Efl.Playable
          }
          return: double; [[Final applied progress, after possible adjustments. 
See @.interpolator.]]
       }
+      @property default_duration @static {
+         [[Duration that will be used by default on all animations unless 
another value
+           is set per object using @.duration.
+         ]]
+         values {
+            animation_time : double; [[Default animation duration, in 
seconds.]]
+         }
+      }
    }
    implements {
+      Efl.Object.constructor;
       Efl.Playable.length { get; }
       Efl.Playable.seekable { get; }
       Efl.Playable.playable { get; }
diff --git a/src/tests/evas/efl_canvas_animation.c 
b/src/tests/evas/efl_canvas_animation.c
index cef036341c..e7d0b16ff9 100644
--- a/src/tests/evas/efl_canvas_animation.c
+++ b/src/tests/evas/efl_canvas_animation.c
@@ -34,7 +34,16 @@ EFL_START_TEST(efl_canvas_animation_negative_double_checking)
 }
 EFL_END_TEST
 
+EFL_START_TEST(efl_canvas_animation_default_value)
+{
+   Efl_Canvas_Animation *animation = efl_new(EFL_CANVAS_ANIMATION_CLASS);
+
+   fail_if(efl_animation_duration_get(animation) == 0.0);
+}
+EFL_END_TEST
+
 void efl_test_canvas_animation(TCase *tc)
 {
    tcase_add_test(tc, efl_canvas_animation_negative_double_checking);
+   tcase_add_test(tc, efl_canvas_animation_default_value);
 }

-- 


Reply via email to