edje: add possibility to speed up animation per object.

This could come handy for previewing the effect of accelerating animation.

@feature
This commit is contained in:
Cedric BAIL 2015-06-22 18:46:12 +02:00
parent 6487a26354
commit a3c7a83196
5 changed files with 42 additions and 3 deletions

View File

@ -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
*

View File

@ -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;

View File

@ -1573,6 +1573,8 @@ struct _Edje
EPhysics_World *world;
#endif
double duration_scale;
Eina_List *user_defined;
lua_State *L;

View File

@ -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;

View File

@ -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));