summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-04 10:14:09 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-12-04 15:28:02 +0100
commit01f6cce01d5f599aae3de3cd736722c3b4b3f650 (patch)
tree6bbd572921023b53c387dc1cea9ad792571a1aa3
parent8c3c0a38feb6256c69525d80b48dccf98a314a3f (diff)
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 Differential Revision: https://phab.enlightenment.org/D10796
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation.c22
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation.eo9
-rw-r--r--src/tests/evas/efl_canvas_animation.c9
3 files changed, 40 insertions, 0 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_animation.c b/src/lib/evas/canvas/efl_canvas_animation.c
index 33ffa035ac..47a367e973 100644
--- a/src/lib/evas/canvas/efl_canvas_animation.c
+++ b/src/lib/evas/canvas/efl_canvas_animation.c
@@ -2,6 +2,8 @@
2 2
3#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS 3#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS
4 4
5static double _standard_animation_time = 0.2; //in seconds
6
5EOLIAN static void 7EOLIAN static void
6_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED, 8_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED,
7 Efl_Canvas_Animation_Data *pd, 9 Efl_Canvas_Animation_Data *pd,
@@ -134,4 +136,24 @@ _efl_canvas_animation_efl_playable_seekable_get(const Eo *eo_obj EINA_UNUSED, Ef
134 return EINA_TRUE; 136 return EINA_TRUE;
135} 137}
136 138
139EOLIAN static Efl_Object*
140_efl_canvas_animation_efl_object_constructor(Eo *obj, Efl_Canvas_Animation_Data *pd)
141{
142 pd->duration = _standard_animation_time;
143 return efl_constructor(efl_super(obj, MY_CLASS));
144}
145
146EOLIAN static void
147_efl_canvas_animation_default_duration_set(double animation_time)
148{
149 EINA_SAFETY_ON_FALSE_RETURN(animation_time > 0.0);
150 _standard_animation_time = animation_time;
151}
152
153EOLIAN static double
154_efl_canvas_animation_default_duration_get(void)
155{
156 return _standard_animation_time;
157}
158
137#include "efl_canvas_animation.eo.c" 159#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
110 } 110 }
111 return: double; [[Final applied progress, after possible adjustments. See @.interpolator.]] 111 return: double; [[Final applied progress, after possible adjustments. See @.interpolator.]]
112 } 112 }
113 @property default_duration @static {
114 [[Duration that will be used by default on all animations unless another value
115 is set per object using @.duration.
116 ]]
117 values {
118 animation_time : double; [[Default animation duration, in seconds.]]
119 }
120 }
113 } 121 }
114 implements { 122 implements {
123 Efl.Object.constructor;
115 Efl.Playable.length { get; } 124 Efl.Playable.length { get; }
116 Efl.Playable.seekable { get; } 125 Efl.Playable.seekable { get; }
117 Efl.Playable.playable { get; } 126 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)
34} 34}
35EFL_END_TEST 35EFL_END_TEST
36 36
37EFL_START_TEST(efl_canvas_animation_default_value)
38{
39 Efl_Canvas_Animation *animation = efl_new(EFL_CANVAS_ANIMATION_CLASS);
40
41 fail_if(efl_animation_duration_get(animation) == 0.0);
42}
43EFL_END_TEST
44
37void efl_test_canvas_animation(TCase *tc) 45void efl_test_canvas_animation(TCase *tc)
38{ 46{
39 tcase_add_test(tc, efl_canvas_animation_negative_double_checking); 47 tcase_add_test(tc, efl_canvas_animation_negative_double_checking);
48 tcase_add_test(tc, efl_canvas_animation_default_value);
40} 49}