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
Index: src/lib/elm_transit.h
===================================================================
--- src/lib/elm_transit.h (revision 83033)
+++ src/lib/elm_transit.h (working copy)
@@ -62,13 +62,28 @@
typedef enum
{
ELM_TRANSIT_TWEEN_MODE_LINEAR, /**< Constant speed */
+ ELM_TRANSIT_TWEEN_MODE_ACCELERATE, /**< Starts slow and increase speed
+ over time */
+ ELM_TRANSIT_TWEEN_MODE_DECELERATE, /**< Starts fast and decrease
+ speed over time */
ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL, /**< Starts slow, increase speed
over time, then decrease again
and stop slowly */
- ELM_TRANSIT_TWEEN_MODE_DECELERATE, /**< Starts fast and decrease
- speed over time */
- ELM_TRANSIT_TWEEN_MODE_ACCELERATE /**< Starts slow and increase speed
- over time */
+ ELM_TRANSIT_TWEEN_MODE_ACCELERATE_FACTOR, /**< Start slow then speed up,
+ v1 being a power factor */
+ ELM_TRANSIT_TWEEN_MODE_DECELERATE_FACTOR, /**< Start fast then slow down,
+ v1 being a power factor */
+ ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL_FACTOR, /**< Start slow, speed up then
+ slow down at end,
+ 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;
/**
@@ -119,6 +134,30 @@ typedef struct _Elm_Transit Elm_Transit;
typedef void Elm_Transit_Effect;
/**
+ * @typedef Elm_Transit_Interp
+ *
+ * ACCEL_FAC, DECEL_FAC and SIN_FAC need the extra optional "interp val 1"
+ * to determine the "factor" of curviness. 1.0 is the same as their non-factor
+ * counterparts, where 0.0 is equal to linear. Numbers higher than one make
+ * the curve angles steeper with a more pronounced curve point.
+ * DIVIS, BOUNCE and SPRING also require "interp val 2" in addition to "interp
val 1".
+ * DIVIS uses val 1 as the initial gradient start (0.0 is horizontal,
+ * 1.0 is diagonal (linear), 2.0 is twice the gradient of linear etc.)
+ * val 2 is interpreted as an integer factor defining how much the value swings
+ * "outside" the gradient only to come back to the final resting spot at the
end.
+ * 0.0 for val 2 is equivalent to linear interpolation. Note that DIVIS can
exceed 1.0
+ * BOUNCE uses val 2 as the number of bounces (so its rounded down to the
nearest
+ * integer value), with val 1 determining how much the bounce decays, with 0.0
+ * giving linear decay per bounce, and higher values giving much more decay.
+ * SPRING is similar to bounce, where val 2 specifies the number of spring
+ * "swings" and val 1 specifies the decay, but it can exceed 1.0 on the outer
swings.
+ */
+typedef struct _Elm_Transit_Interp
+{
+ double v1, v2;
+} Elm_Transit_Interp;
+
+/**
* @typedef Elm_Transit_Effect_Transition_Cb
*
* Transition callback called for this effect on each transition iteration.
@@ -411,9 +450,21 @@ 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_ACCELERATE - The animation will accelerate over time.
+ * ELM_TRANSIT_TWEEN_MODE_DECELERATE - The animation will be slowed over time.
* 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_ACCELERATE_FACTOR - Start slow then speed up with
factor
+ * ELM_TRANSIT_TWEEN_MODE_DECELERATE_FACTOR - Start fast then slow down with
factor
+ * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL_FACTOR - Start slow, speed up then slow
down at end
+ * 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 +487,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_ACCELERATE_FACTOR - Start slow then speed up, v1
being a
+ * power factor, 0.0 being linear, 1.0 being
ELM_TRANSIT_TWEEN_MODE_ACCELERATE, 2.0
+ * being much more pronounced accelerate (squared), 3.0 being cubed, etc.
+ * ELM_TRANSIT_TWEEN_MODE_DECELERATE_FACTOR - Start fast then slow down, v1
being a
+ * power factor, 0.0 being linear, 1.0 being
ELM_TRANSIT_TWEEN_MODE_DECELERATE, 2.0
+ * being much more pronounced decelerate (squared), 3.0 being cubed, etc.
+ * ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL_FACTOR - 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, 2.0 being much more pronounced sinusoidal
+ * (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 The interpolation value. If @p transit is NULL
+ * EINA_FALSE is returned.
+ *
+ * @ingroup Transit
+ */
+EAPI Elm_Transit_Interp *elm_transit_tween_mode_factor_get(const
Elm_Transit *transit);
+
+/**
* Set the transit animation time
*
* @note @p transit can not be NULL
Index: src/lib/elm_transit.c
===================================================================
--- src/lib/elm_transit.c (revision 83033)
+++ 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;
+ Elm_Transit_Interp *interp;
};
struct _Elm_Transit_Effect_Module
@@ -269,6 +270,10 @@ _transit_del(Elm_Transit *transit)
if (transit->del_data.func)
transit->del_data.func(transit->del_data.arg, transit);
+ //remove interp
+ if (transit->interp)
+ free(transit->interp);
+
//cut off the chain transit relationship
EINA_LIST_FOREACH_SAFE(transit->next_chain_transits, elist, elist_next,
chain_transit)
chain_transit->prev_chain_transit = NULL;
@@ -282,7 +287,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);
@@ -355,6 +359,39 @@ _transit_animate_cb(void *data)
ECORE_POS_MAP_SINUSOIDAL,
0, 0);
break;
+ case ELM_TRANSIT_TWEEN_MODE_ACCELERATE_FACTOR:
+ transit->progress = ecore_animator_pos_map(transit->progress,
+
ECORE_POS_MAP_ACCELERATE_FACTOR,
+ transit->interp->v1, 0);
+ break;
+ case ELM_TRANSIT_TWEEN_MODE_DECELERATE_FACTOR:
+ transit->progress = ecore_animator_pos_map(transit->progress,
+
ECORE_POS_MAP_DECELERATE_FACTOR,
+ transit->interp->v1, 0);
+ break;
+ case ELM_TRANSIT_TWEEN_MODE_SINUSOIDAL_FACTOR:
+ transit->progress = ecore_animator_pos_map(transit->progress,
+
ECORE_POS_MAP_SINUSOIDAL_FACTOR,
+ transit->interp->v1, 0);
+ break;
+ case ELM_TRANSIT_TWEEN_MODE_DIVISOR_INTERP:
+ transit->progress = ecore_animator_pos_map(transit->progress,
+
ECORE_POS_MAP_DIVISOR_INTERP,
+ transit->interp->v1,
+ transit->interp->v2);
+ break;
+ case ELM_TRANSIT_TWEEN_MODE_BOUNCE:
+ transit->progress = ecore_animator_pos_map(transit->progress,
+ ECORE_POS_MAP_BOUNCE,
+ transit->interp->v1,
+ transit->interp->v2);
+ break;
+ case ELM_TRANSIT_TWEEN_MODE_SPRING:
+ transit->progress = ecore_animator_pos_map(transit->progress,
+ ECORE_POS_MAP_SPRING,
+ transit->interp->v1,
+ transit->interp->v2);
+ break;
default:
break;
}
@@ -635,6 +672,22 @@ 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->interp = ELM_NEW(Elm_Transit_Interp);
+ transit->interp->v1 = v1;
+ transit->interp->v2 = v2;
+}
+
+EAPI Elm_Transit_Interp *
+elm_transit_tween_mode_factor_get(const Elm_Transit *transit)
+{
+ ELM_TRANSIT_CHECK_OR_RETURN(transit, NULL);
+ return transit->interp;
+}
+
+EAPI void
elm_transit_duration_set(Elm_Transit *transit, double duration)
{
ELM_TRANSIT_CHECK_OR_RETURN(transit);
------------------------------------------------------------------------------
Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS
and more. Get SQL Server skills now (including 2012) with LearnDevNow -
200+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only - learn more at:
http://p.sf.net/sfu/learnmore_122512
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel