elementary/transit - [Patch] elm_transit feature extenstion

Hi all,
All tween modes are added and you can set the interp.

   ELM_TRANSIT_TWEEN_MODE_ACCELERATE_FACTOR

   ELM_TRANSIT_TWEEN_MODE_DECELERATE_FACTOR

   ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL_FACTOR

   ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP

   ELM_TRANSIT_TWEEN_MODE_BOUNCE                     

   ELM_TRANSIT_TWEEN_MODE_SPRING



   EAPI void elm_transit_tween_mode_factor_set(Elm_Transit *transit, double v1, double v2);

   EAPI Elm_Transit_Interp *elm_transit_tween_mode_factor_get(const Elm_Transit *transit);

Thanks,
Joey

Singed-Off-By: ChanWook Jeong<jchanwook@gmail.com>



SVN revision: 83344
This commit is contained in:
ChunEon Park 2013-01-26 04:35:58 +00:00
parent d0c174b642
commit 704f70ba81
4 changed files with 117 additions and 11 deletions

View File

@ -948,3 +948,7 @@
2012-01-23 WooHyun Jung
* In _timer_cb of elm_notify, access to sd should be forbidden after smart_callback_call is called.
2012-01-26 ChanWook Jung (jchanwook@gmail.com)
* Expand elm_transit tween_mode and add twee_mode_factor_set(),get() APIs

View File

@ -56,6 +56,8 @@ Improvements:
existed actually. since these parts are really dependent on the platform,
in most case they don't need all parts at the same time.
* Enhanced diskselector add and item_append time.
* Expand elm_transit_tween_mode ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP, ELM_TRANSIT_TWEEN_MODE_BOUNCE, ELM_TRANSIT_TWEEN_MODE_SPRING
* Added new APIs elm_transit_tween_mode_facator_set()/get()
Fixes:

View File

@ -53,6 +53,7 @@ struct _Elm_Transit
double progress;
unsigned int effects_pending_del;
int walking;
double v1, v2;
Eina_Bool auto_reverse : 1;
Eina_Bool event_enabled : 1;
Eina_Bool deleted : 1;
@ -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,17 +343,32 @@ _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;
@ -455,6 +470,9 @@ elm_transit_add(void)
elm_transit_tween_mode_set(transit, ELM_TRANSIT_TWEEN_MODE_LINEAR);
transit->v1 = 1.0;
transit->v2 = 0.0;
return transit;
}
@ -634,6 +652,22 @@ elm_transit_tween_mode_get(const Elm_Transit *transit)
return transit->tween_mode;
}
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 void
elm_transit_tween_mode_factor_get(const Elm_Transit *transit, double *v1, double *v2)
{
ELM_TRANSIT_CHECK_OR_RETURN(transit);
if (v1) *v1 = transit->v1;
if (v2) *v2 = transit->v2;
}
EAPI void
elm_transit_duration_set(Elm_Transit *transit, double duration)
{

View File

@ -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,18 @@ EAPI int elm_transit_repeat_times_get(const Elm_Transit *tran
*
* 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.
@ -435,6 +452,55 @@ EAPI void elm_transit_tween_mode_set(Elm_Transit *transit, Elm
*/
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 factor 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 (default is 1.0)
* @param v2 A parameter use by the mapping (default is 0.0)
*
* @see elm_transit_tween_mode_factor_get()
*
* @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.
* @param v1 Pointer to an double in which to store the factor value.
* @param v2 Pointer to an double in which to store the factor value2.
*
* @see elm_transit_tween_mode_factor_set()
*
* @ingroup Transit
*/
EAPI void elm_transit_tween_mode_factor_get(const Elm_Transit *transit, double *v1, double *v2);
/**
* Set the transit animation time
*