forked from enlightenment/efl
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 <xavierartigas@yahoo.es> Differential Revision: https://phab.enlightenment.org/D10796
This commit is contained in:
parent
10b631e7cb
commit
a29be18b5f
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS
|
#define MY_CLASS EFL_CANVAS_ANIMATION_CLASS
|
||||||
|
|
||||||
|
static double _default_animation_time = 0.2; //in seconds
|
||||||
|
|
||||||
EOLIAN static void
|
EOLIAN static void
|
||||||
_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED,
|
_efl_canvas_animation_duration_set(Eo *eo_obj EINA_UNUSED,
|
||||||
Efl_Canvas_Animation_Data *pd,
|
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;
|
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"
|
#include "efl_canvas_animation.eo.c"
|
||||||
|
|
|
@ -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.]]
|
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 {
|
implements {
|
||||||
|
Efl.Object.constructor;
|
||||||
Efl.Playable.length { get; }
|
Efl.Playable.length { get; }
|
||||||
Efl.Playable.seekable { get; }
|
Efl.Playable.seekable { get; }
|
||||||
Efl.Playable.playable { get; }
|
Efl.Playable.playable { get; }
|
||||||
|
|
|
@ -34,7 +34,16 @@ EFL_START_TEST(efl_canvas_animation_negative_double_checking)
|
||||||
}
|
}
|
||||||
EFL_END_TEST
|
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)
|
void efl_test_canvas_animation(TCase *tc)
|
||||||
{
|
{
|
||||||
tcase_add_test(tc, efl_canvas_animation_negative_double_checking);
|
tcase_add_test(tc, efl_canvas_animation_negative_double_checking);
|
||||||
|
tcase_add_test(tc, efl_canvas_animation_default_value);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue