Index: src/lib/elm_transit.c =================================================================== --- src/lib/elm_transit.c (revision 83199) +++ src/lib/elm_transit.c (working copy) @@ -58,6 +58,7 @@ struct _Elm_Transit Eina_Bool deleted : 1; Eina_Bool state_keep : 1; Eina_Bool finished : 1; + double v1, v2; }; struct _Elm_Transit_Effect_Module @@ -282,7 +283,6 @@ _transit_del(Elm_Transit *transit) { EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next, chain_transit) _transit_chain_go(chain_transit); - } eina_list_free(transit->next_chain_transits); @@ -343,18 +343,33 @@ _transit_animate_cb(void *data) case ELM_TRANSIT_TWEEN_MODE_ACCELERATE: transit->progress = ecore_animator_pos_map(transit->progress, ECORE_POS_MAP_ACCELERATE, - 0, 0); + transit->v1, 0); break; case ELM_TRANSIT_TWEEN_MODE_DECELERATE: transit->progress = ecore_animator_pos_map(transit->progress, ECORE_POS_MAP_DECELERATE, - 0, 0); + transit->v1, 0); break; case ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL: transit->progress = ecore_animator_pos_map(transit->progress, ECORE_POS_MAP_SINUSOIDAL, - 0, 0); + transit->v1, 0); break; + case ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP: + transit->progress = ecore_animator_pos_map(transit->progress, + ECORE_POS_MAP_DIVISOR_INTERP, + transit->v1, transit->v2); + break; + case ELM_TRANSIT_TWEEN_MODE_BOUNCE: + transit->progress = ecore_animator_pos_map(transit->progress, + ECORE_POS_MAP_BOUNCE, + transit->v1, transit->v2); + break; + case ELM_TRANSIT_TWEEN_MODE_SPRING: + transit->progress = ecore_animator_pos_map(transit->progress, + ECORE_POS_MAP_SPRING, + transit->v1, transit->v2); + break; default: break; } @@ -625,6 +640,34 @@ elm_transit_tween_mode_set(Elm_Transit *transit, E { ELM_TRANSIT_CHECK_OR_RETURN(transit); transit->tween_mode = tween_mode; + + transit->v1 = 0.0; + transit->v2 = 0.0; + switch (transit->tween_mode) + { + case ELM_TRANSIT_TWEEN_MODE_LINEAR: + break; + case ELM_TRANSIT_TWEEN_MODE_ACCELERATE: + case ELM_TRANSIT_TWEEN_MODE_DECELERATE: + case ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL: + transit->v1 = 1.0; + break; + case ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP: + transit->v1 = 2.0; + transit->v2 = 2.0; + break; + case ELM_TRANSIT_TWEEN_MODE_BOUNCE: + transit->v1 = 1.0; + transit->v2 = 1.0; + break; + case ELM_TRANSIT_TWEEN_MODE_SPRING: + transit->v1 = 1.0; + transit->v2 = 1.0; + break; + default: + break; + } + } EAPI Elm_Transit_Tween_Mode @@ -635,6 +678,23 @@ elm_transit_tween_mode_get(const Elm_Transit *tran } EAPI void +elm_transit_tween_mode_factor_set(Elm_Transit *transit, double v1, double v2) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit); + transit->v1 = v1; + transit->v2 = v2; +} + +EAPI Eina_Bool +elm_transit_tween_mode_factor_get(const Elm_Transit *transit, double *v1, double *v2) +{ + ELM_TRANSIT_CHECK_OR_RETURN(transit, EINA_FALSE); + *v1 = transit->v1; + *v2 = transit->v2; + return EINA_TRUE; +} + +EAPI void elm_transit_duration_set(Elm_Transit *transit, double duration) { ELM_TRANSIT_CHECK_OR_RETURN(transit); Index: src/lib/elm_transit.h =================================================================== --- src/lib/elm_transit.h (revision 83199) +++ src/lib/elm_transit.h (working copy) @@ -64,11 +64,19 @@ typedef enum ELM_TRANSIT_TWEEN_MODE_LINEAR, /**< Constant speed */ ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL, /**< Starts slow, increase speed over time, then decrease again - and stop slowly */ + and stop slowly, v1 being a power factor */ ELM_TRANSIT_TWEEN_MODE_DECELERATE, /**< Starts fast and decrease - speed over time */ - ELM_TRANSIT_TWEEN_MODE_ACCELERATE /**< Starts slow and increase speed - over time */ + speed over time, v1 being a power factor */ + ELM_TRANSIT_TWEEN_MODE_ACCELERATE, /**< Starts slow and increase speed + over time, v1 being a power factor */ + ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP, /**< Start at gradient v1, + interpolated via power of v2 curve */ + ELM_TRANSIT_TWEEN_MODE_BOUNCE, /**< Start at 0.0 then "drop" like a ball + bouncing to the ground at 1.0, and + bounce v2 times, with decay factor of v1 */ + ELM_TRANSIT_TWEEN_MODE_SPRING /**< Start at 0.0 then "wobble" like a spring + rest position 1.0, and wobble v2 times, + with decay factor of v1 */ } Elm_Transit_Tween_Mode; /** @@ -411,9 +419,17 @@ EAPI int elm_transit_repeat_tim * * This function sets the tween mode of the transit that can be: * ELM_TRANSIT_TWEEN_MODE_LINEAR - The default mode. - * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL - Starts in accelerate mode and ends decelerating. - * ELM_TRANSIT_TWEEN_MODE_DECELERATE - The animation will be slowed over time. - * ELM_TRANSIT_TWEEN_MODE_ACCELERATE - The animation will accelerate over time. + * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL - Starts in accelerate mode and ends decelerating with factor. + * ELM_TRANSIT_TWEEN_MODE_DECELERATE - The animation will be slowed over time with factor. + * ELM_TRANSIT_TWEEN_MODE_ACCELERATE - The animation will accelerate over time with factor. + * ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP - Start at gradient v1, + * interpolated via power of v2 curve + * ELM_TRANSIT_TWEEN_MODE_BOUNCE - Start at 0.0 then "drop" like a ball + * bouncing to the ground at 1.0, and + * bounce v2 times, with decay factor of v1 + * ELM_TRANSIT_TWEEN_MODE_SPRING - Start at 0.0 then "wobble" like a spring + * rest position 1.0, and wobble v2 times, + * with decay factor of v1 * * @param transit The transit object. * @param tween_mode The tween type. @@ -436,6 +452,49 @@ EAPI void elm_transit_tween_mode EAPI Elm_Transit_Tween_Mode elm_transit_tween_mode_get(const Elm_Transit *transit); /** + * Set the transit animation acceleration factor. + * + * This function sets the tween mode facotr of the transit that can be: + * If you use the below tween modes, you have to set the factor using this API. + * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL - Start slow, speed up then slow down + * at end, v1 being a power factor, 0.0 being linear, 1.0 being + * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL default, 2.0 being much more pronounced sinusoidal + * (squared), 3.0 being cubed, etc. + * ELM_TRANSIT_TWEEN_MODE_DECELERATE - Start fast then slow down, v1 being a + * power factor, 0.0 being linear, 1.0 being ELM_TRANSIT_TWEEN_MODE_DECELERATE default, 2.0 + * being much more pronounced decelerate (squared), 3.0 being cubed, etc. + * ELM_TRANSIT_TWEEN_MODE_ACCELERATE - Start slow then speed up, v1 being a + * power factor, 0.0 being linear, 1.0 being ELM_TRANSIT_TWEEN_MODE_ACCELERATE default, 2.0 + * being much more pronounced accelerate (squared), 3.0 being cubed, etc. + * ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP - Start at gradient * v1, interpolated via + * power of v2 curve + * ELM_TRANSIT_TWEEN_MODE_BOUNCE - Start at 0.0 then "drop" like a ball bouncing to + * the ground at 1.0, and bounce v2 times, with decay factor of v1 + * ELM_TRANSIT_TWEEN_MODE_SPRING - Start at 0.0 then "wobble" like a spring rest + * position 1.0, and wobble v2 times, with decay factor of v1 + * + * @param transit The transit object. + * @param v1 A parameter use by the mapping (pass 0.0 if not used) + * @param v2 A parameter use by the mapping (pass 0.0 if not used) + * + * @ingroup Transit + */ +EAPI void elm_transit_tween_mode_factor_set(Elm_Transit *transit, double v1, double v2); + +/** + * Get the transit animation acceleration factor. + * + * @note @p transit can not be NULL + * + * @param transit The transit object. + * @return EINA_TRUE means transition is paused. If @p transit is NULL + * EINA_FALSE is returned + * + * @ingroup Transit + */ +EAPI Eina_Bool elm_transit_tween_mode_factor_get(const Elm_Transit *transit, double *v1, double *v2); + +/** * Set the transit animation time * * @note @p transit can not be NULL