From 9fbe7c80ab32ca2b4970ff27129467e759cdb475 Mon Sep 17 00:00:00 2001 From: raster Date: Mon, 16 May 2011 13:16:34 +0000 Subject: [PATCH] use the ecore pos map call for edje as opposed to do it yourself. this also opens up new position mappings like factored accel/decel/sin, divis, bounce and spring! :) documentation provided. git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/edje@59449 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33 --- ChangeLog | 7 +++ src/bin/edje_cc_handlers.c | 90 +++++++++++++++++++++++++++- src/lib/Edje.h | 18 ++++-- src/lib/edje_calc.c | 146 ++++++++++++++++++++++++++++++++++----------- src/lib/edje_data.c | 2 + src/lib/edje_embryo.c | 4 +- src/lib/edje_lua.c | 4 +- src/lib/edje_private.h | 4 +- src/lib/edje_program.c | 20 +++++-- 9 files changed, 240 insertions(+), 55 deletions(-) diff --git a/ChangeLog b/ChangeLog index 58c349b..1512504 100644 --- a/ChangeLog +++ b/ChangeLog @@ -90,3 +90,10 @@ text to the end of the textblock part. This lets us do cool thing like population of textblock using idler. +2011-05-16 Carsten Haitzler (The Rasterman) + + * Add new interpolation modes for programs to make animation + much easier. Added: ACCEL_FAC, DECEL_FAC, SIN_FAC, DIVIS, + BOUNCE, SPRING (also made short name versions of the long ones + possible too). + diff --git a/src/bin/edje_cc_handlers.c b/src/bin/edje_cc_handlers.c index 13c8f51..3d8af0c 100644 --- a/src/bin/edje_cc_handlers.c +++ b/src/bin/edje_cc_handlers.c @@ -7187,26 +7187,110 @@ st_collections_group_programs_program_action(void) @property transition @parameters - [type] [length] + [type] [length] [[interp val 1]] [[interp val 2]] @effect Defines how transitions occur using STATE_SET action.\n Where 'type' is the style of the transition and 'length' is a double specifying the number of seconds in which to preform the transition.\n - Valid types are: LINEAR, SINUSOIDAL, ACCELERATE, and DECELERATE. + Valid types are: LIN or LINEAR, SIN or SINUSOIDAL, + ACCEL or ACCELERATE, DECEL or DECELERATE, + ACCEL_FAC or ACCELERATE_FACTOR, DECEL_FAC or DECELERATE_FACTOR, + SIN_FAC or SINUSOIDAL_FACTOR, DIVIS or DIVISOR_INTERP, + BOUNCE, SPRING. + + 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 + prnounced curve point. + + DIVIS, BOUNCE and SPRING also require "interp val 2" in addition + to "interp val 1". + + DIVIS uses val 1 as the initial graident 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 2 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. + @endproperty */ static void st_collections_group_programs_program_transition(void) { - check_arg_count(2); + check_min_arg_count(2); current_program->tween.mode = parse_enum(0, + // short names + "LIN", EDJE_TWEEN_MODE_LINEAR, + "SIN", EDJE_TWEEN_MODE_SINUSOIDAL, + "ACCEL", EDJE_TWEEN_MODE_ACCELERATE, + "DECEL", EDJE_TWEEN_MODE_DECELERATE, + "ACCEL_FAC", EDJE_TWEEN_MODE_ACCELERATE_FACTOR, + "DECEL_FAC", EDJE_TWEEN_MODE_DECELERATE_FACTOR, + "SIN_FAC", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR, + "DIVIS", EDJE_TWEEN_MODE_DIVISOR_INTERP, + + // long/full names "LINEAR", EDJE_TWEEN_MODE_LINEAR, "SINUSOIDAL", EDJE_TWEEN_MODE_SINUSOIDAL, "ACCELERATE", EDJE_TWEEN_MODE_ACCELERATE, "DECELERATE", EDJE_TWEEN_MODE_DECELERATE, + "ACCELERATE_FACTOR", EDJE_TWEEN_MODE_ACCELERATE_FACTOR, + "DECELERATE_FACTOR", EDJE_TWEEN_MODE_DECELERATE_FACTOR, + "SINUSOIDAL_FACTOR", EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR, + "DIVISOR_INTERP", EDJE_TWEEN_MODE_DIVISOR_INTERP, + + // long/full is short enough + "BOUNCE", EDJE_TWEEN_MODE_BOUNCE, + "SPRING", EDJE_TWEEN_MODE_SPRING, NULL); current_program->tween.time = FROM_DOUBLE(parse_float_range(1, 0.0, 999999999.0)); + // the following need v1 + // EDJE_TWEEN_MODE_ACCELERATE_FACTOR + // EDJE_TWEEN_MODE_DECELERATE_FACTOR + // EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR + // current_program->tween.v1 + if ((current_program->tween.mode >= EDJE_TWEEN_MODE_ACCELERATE_FACTOR) && + (current_program->tween.mode <= EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR)) + { + if (get_arg_count() != 3) + { + ERR("%s: Error. parse error %s:%i. " + "Need 3rd parameter to set factor", + progname, file_in, line - 1); + exit(-1); + } + current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0)); + } + // the followjng also need v2 + // EDJE_TWEEN_MODE_DIVISOR_INTERP + // EDJE_TWEEN_MODE_BOUNCE + // EDJE_TWEEN_MODE_SPRING + // current_program->tween.v2 + else if ((current_program->tween.mode >= EDJE_TWEEN_MODE_DIVISOR_INTERP) && + (current_program->tween.mode <= EDJE_TWEEN_MODE_SPRING)) + { + if (get_arg_count() != 4) + { + ERR("%s: Error. parse error %s:%i. " + "Need 3rd and 4th parameters to set factor and counts", + progname, file_in, line - 1); + exit(-1); + } + current_program->tween.v1 = FROM_DOUBLE(parse_float_range(2, 0.0, 999999999.0)); + current_program->tween.v2 = FROM_DOUBLE(parse_float_range(3, 0.0, 999999999.0)); + } } /** diff --git a/src/lib/Edje.h b/src/lib/Edje.h index 4b4fc7a..8735028 100644 --- a/src/lib/Edje.h +++ b/src/lib/Edje.h @@ -683,12 +683,18 @@ typedef enum _Edje_Action_Type typedef enum _Edje_Tween_Mode { - EDJE_TWEEN_MODE_NONE = 0, - EDJE_TWEEN_MODE_LINEAR = 1, - EDJE_TWEEN_MODE_SINUSOIDAL = 2, - EDJE_TWEEN_MODE_ACCELERATE = 3, - EDJE_TWEEN_MODE_DECELERATE = 4, - EDJE_TWEEN_MODE_LAST = 5 + EDJE_TWEEN_MODE_NONE = 0, + EDJE_TWEEN_MODE_LINEAR = 1, + EDJE_TWEEN_MODE_SINUSOIDAL = 2, + EDJE_TWEEN_MODE_ACCELERATE = 3, + EDJE_TWEEN_MODE_DECELERATE = 4, + EDJE_TWEEN_MODE_ACCELERATE_FACTOR = 5, + EDJE_TWEEN_MODE_DECELERATE_FACTOR = 6, + EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR = 7, + EDJE_TWEEN_MODE_DIVISOR_INTERP = 8, + EDJE_TWEEN_MODE_BOUNCE = 9, + EDJE_TWEEN_MODE_SPRING = 10, + EDJE_TWEEN_MODE_LAST = 11 } Edje_Tween_Mode; typedef enum _Edje_Cursor diff --git a/src/lib/edje_calc.c b/src/lib/edje_calc.c index 3c43580..5dff9d9 100644 --- a/src/lib/edje_calc.c +++ b/src/lib/edje_calc.c @@ -16,7 +16,7 @@ static void _edje_part_recalc_single(Edje *ed, Edje_Real_Part *ep, static void _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags); void -_edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos) +_edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2) { FLOAT_T fp_pos; FLOAT_T npos; @@ -26,6 +26,7 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos) fp_pos = pos; npos = ZERO; +#if 0 // old code - easy to enable for comparing float vs fixed point /* take linear pos along timescale and use interpolation method */ switch (mode) { @@ -51,8 +52,69 @@ _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos) npos = fp_pos; break; default: - break; + npos = fp_pos; + break; + } +#else + switch (mode) + { + case EDJE_TWEEN_MODE_SINUSOIDAL: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_SINUSOIDAL, + 0.0, 0.0)); + break; + case EDJE_TWEEN_MODE_ACCELERATE: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_ACCELERATE, + 0.0, 0.0)); + break; + case EDJE_TWEEN_MODE_DECELERATE: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_DECELERATE, + 0.0, 0.0)); + break; + case EDJE_TWEEN_MODE_LINEAR: + npos = fp_pos; +/* npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_LINEAR, + 0.0, 0.0)); + */ + break; + case EDJE_TWEEN_MODE_ACCELERATE_FACTOR: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_ACCELERATE_FACTOR, + TO_DOUBLE(v1), 0.0)); + break; + case EDJE_TWEEN_MODE_DECELERATE_FACTOR: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_DECELERATE_FACTOR, + TO_DOUBLE(v1), 0.0)); + break; + case EDJE_TWEEN_MODE_SINUSOIDAL_FACTOR: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_SINUSOIDAL_FACTOR, + TO_DOUBLE(v1), 0.0)); + break; + case EDJE_TWEEN_MODE_DIVISOR_INTERP: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_DIVISOR_INTERP, + TO_DOUBLE(v1), TO_DOUBLE(v2))); + break; + case EDJE_TWEEN_MODE_BOUNCE: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_BOUNCE, + TO_DOUBLE(v1), TO_DOUBLE(v2))); + break; + case EDJE_TWEEN_MODE_SPRING: + npos = FROM_DOUBLE(ecore_animator_pos_map(TO_DOUBLE(pos), + ECORE_POS_MAP_SPRING, + TO_DOUBLE(v1), TO_DOUBLE(v2))); + break; + default: + npos = fp_pos; + break; } +#endif if (npos == ep->description_pos) return; ep->description_pos = npos; @@ -1859,7 +1921,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) Edje_Calc_Params *p1, *pf; Edje_Part_Description_Common *chosen_desc; Edje_Real_Part *confine_to = NULL; - FLOAT_T pos = ZERO; + FLOAT_T pos = ZERO, pos2; Edje_Calc_Params lp3; /* GRADIENT ARE GONE, WE MUST IGNORE IT FROM OLD FILE. */ @@ -2058,6 +2120,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) } pos = ep->description_pos; + pos2 = pos; + if (pos2 < ZERO) pos2 = ZERO; + else if (pos2 > FROM_INT(1)) pos2 = FROM_INT(1); beginning_pos = (pos < FROM_DOUBLE(0.5)); part_type = ep->part->type; @@ -2106,10 +2171,10 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) p3->req_drag.h = INTP(p1->req_drag.h, p2->req_drag.h, pos); } - p3->color.r = INTP(p1->color.r, p2->color.r, pos); - p3->color.g = INTP(p1->color.g, p2->color.g, pos); - p3->color.b = INTP(p1->color.b, p2->color.b, pos); - p3->color.a = INTP(p1->color.a, p2->color.a, pos); + p3->color.r = INTP(p1->color.r, p2->color.r, pos2); + p3->color.g = INTP(p1->color.g, p2->color.g, pos2); + p3->color.b = INTP(p1->color.b, p2->color.b, pos2); + p3->color.a = INTP(p1->color.a, p2->color.a, pos2); switch (part_type) { @@ -2127,19 +2192,19 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) case EDJE_PART_TYPE_TEXT: p3->type.text.size = INTP(p1->type.text.size, p2->type.text.size, pos); case EDJE_PART_TYPE_TEXTBLOCK: - p3->type.text.color2.r = INTP(p1->type.text.color2.r, p2->type.text.color2.r, pos); - p3->type.text.color2.g = INTP(p1->type.text.color2.g, p2->type.text.color2.g, pos); - p3->type.text.color2.b = INTP(p1->type.text.color2.b, p2->type.text.color2.b, pos); - p3->type.text.color2.a = INTP(p1->type.text.color2.a, p2->type.text.color2.a, pos); + p3->type.text.color2.r = INTP(p1->type.text.color2.r, p2->type.text.color2.r, pos2); + p3->type.text.color2.g = INTP(p1->type.text.color2.g, p2->type.text.color2.g, pos2); + p3->type.text.color2.b = INTP(p1->type.text.color2.b, p2->type.text.color2.b, pos2); + p3->type.text.color2.a = INTP(p1->type.text.color2.a, p2->type.text.color2.a, pos2); - p3->type.text.color3.r = INTP(p1->type.text.color3.r, p2->type.text.color3.r, pos); - p3->type.text.color3.g = INTP(p1->type.text.color3.g, p2->type.text.color3.g, pos); - p3->type.text.color3.b = INTP(p1->type.text.color3.b, p2->type.text.color3.b, pos); - p3->type.text.color3.a = INTP(p1->type.text.color3.a, p2->type.text.color3.a, pos); + p3->type.text.color3.r = INTP(p1->type.text.color3.r, p2->type.text.color3.r, pos2); + p3->type.text.color3.g = INTP(p1->type.text.color3.g, p2->type.text.color3.g, pos2); + p3->type.text.color3.b = INTP(p1->type.text.color3.b, p2->type.text.color3.b, pos2); + p3->type.text.color3.a = INTP(p1->type.text.color3.a, p2->type.text.color3.a, pos2); p3->type.text.align.x = FFP(p1->type.text.align.x, p2->type.text.align.x, pos); p3->type.text.align.y = FFP(p1->type.text.align.y, p2->type.text.align.y, pos); - p3->type.text.elipsis = TO_DOUBLE(FINTP(p1->type.text.elipsis, p2->type.text.elipsis, pos)); + p3->type.text.elipsis = TO_DOUBLE(FINTP(p1->type.text.elipsis, p2->type.text.elipsis, pos2)); break; } @@ -2277,6 +2342,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) desc2 = NULL; if (ep->param2) desc2 = ep->param2->description; pos = ep->description_pos; + pos2 = pos; + if (pos2 < ZERO) pos2 = ZERO; + else if (pos2 > FROM_INT(1)) pos2 = FROM_INT(1); ed->have_mapped_part = 1; // create map and populate with part geometry @@ -2387,7 +2455,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) if (ep2) { Edje_Part_Description_Common *ep2desc1, *ep2desc2; - FLOAT_T ep2pos; + FLOAT_T ep2pos, ep2pos2; do1 = 1; if (!ep2->calculated) @@ -2396,6 +2464,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) ep2desc2 = NULL; if (ep2->param2) ep2desc2 = ep2->param2->description; ep2pos = ep2->description_pos; + ep2pos2 = ep2pos; + if (ep2pos2 < ZERO) ep2pos2 = ZERO; + else if (ep2pos2 > FROM_INT(1)) ep2pos2 = FROM_INT(1); // light x and y are already interpolated in part geom lx1 = ed->x + ep2->x + (ep2->w / 2); @@ -2407,22 +2478,22 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane - ep2desc1->persp.zplane)); lr1 = ep2desc1->color.r + - TO_INT(SCALE(ep2pos, ep2desc2->color.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color.r - ep2desc1->color.r)); lg1 = ep2desc1->color.g + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lb1 = ep2desc1->color.b + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lar1 = ep2desc1->color2.r + - TO_INT(SCALE(ep2pos, ep2desc2->color2.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.r - ep2desc1->color2.r)); lag1 = ep2desc1->color2.g + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); lab1 = ep2desc1->color2.b + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); } else @@ -2448,7 +2519,7 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) if (ep2) { Edje_Part_Description_Common *ep2desc1, *ep2desc2; - FLOAT_T ep2pos; + FLOAT_T ep2pos, ep2pos2; do2 = 1; if (!ep2->calculated) @@ -2457,6 +2528,9 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) ep2desc2 = NULL; if (ep2->param2) ep2desc2 = ep2->param2->description; ep2pos = ep2->description_pos; + ep2pos2 = ep2pos; + if (ep2pos2 < ZERO) ep2pos2 = ZERO; + else if (ep2pos2 > FROM_INT(1)) ep2pos2 = FROM_INT(1); // light x and y are already interpolated in part geom lx2 = ed->x + ep2->x + (ep2->w / 2); @@ -2468,22 +2542,22 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) TO_INT(SCALE(ep2pos, ep2desc2->persp.zplane - ep2desc1->persp.zplane)); lr2 = ep2desc1->color.r + - TO_INT(SCALE(ep2pos, ep2desc2->color.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color.r - ep2desc1->color.r)); lg2 = ep2desc1->color.g + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lb2 = ep2desc1->color.b + - TO_INT(SCALE(ep2pos, ep2desc2->color.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color.g - ep2desc1->color.b)); lar2 = ep2desc1->color2.r + - TO_INT(SCALE(ep2pos, ep2desc2->color2.r - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.r - ep2desc1->color2.r)); lag2 = ep2desc1->color2.g + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); lab2 = ep2desc1->color2.b + - TO_INT(SCALE(ep2pos, ep2desc2->color2.g - + TO_INT(SCALE(ep2pos2, ep2desc2->color2.g - ep2desc1->color2.b)); } else @@ -2503,12 +2577,12 @@ _edje_part_recalc(Edje *ed, Edje_Real_Part *ep, int flags) lx = lx1 + TO_INT(SCALE(pos, lx2 - lx1)); ly = ly1 + TO_INT(SCALE(pos, ly2 - ly1)); lz = lz1 + TO_INT(SCALE(pos, lz2 - lz1)); - lr = lr1 + TO_INT(SCALE(pos, lr2 - lr1)); - lg = lg1 + TO_INT(SCALE(pos, lg2 - lg1)); - lb = lb1 + TO_INT(SCALE(pos, lb2 - lb1)); - lar = lar1 + TO_INT(SCALE(pos, lar2 - lar1)); - lag = lag1 + TO_INT(SCALE(pos, lag2 - lag1)); - lab = lab1 + TO_INT(SCALE(pos, lab2 - lab1)); + lr = lr1 + TO_INT(SCALE(pos2, lr2 - lr1)); + lg = lg1 + TO_INT(SCALE(pos2, lg2 - lg1)); + lb = lb1 + TO_INT(SCALE(pos2, lb2 - lb1)); + lar = lar1 + TO_INT(SCALE(pos2, lar2 - lar1)); + lag = lag1 + TO_INT(SCALE(pos2, lag2 - lag1)); + lab = lab1 + TO_INT(SCALE(pos2, lab2 - lab1)); } else if (do1) { diff --git a/src/lib/edje_data.c b/src/lib/edje_data.c index ea4bb24..cfd03a4 100644 --- a/src/lib/edje_data.c +++ b/src/lib/edje_data.c @@ -373,6 +373,8 @@ _edje_edd_init(void) EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "value2", value2, EET_T_DOUBLE); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.mode", tween.mode, EET_T_INT); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "tween.time", tween.time, EDJE_T_FLOAT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "v1", tween.v1, EDJE_T_FLOAT); + EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "v2", tween.v2, EDJE_T_FLOAT); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "targets", targets, _edje_edd_edje_program_target); EET_DATA_DESCRIPTOR_ADD_LIST(_edje_edd_edje_program, Edje_Program, "after", after, _edje_edd_edje_program_after); EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_program, Edje_Program, "api.name", api.name, EET_T_STRING); diff --git a/src/lib/edje_embryo.c b/src/lib/edje_embryo.c index c3c49ab..e0c5f7d 100644 --- a/src/lib/edje_embryo.c +++ b/src/lib/edje_embryo.c @@ -846,7 +846,7 @@ _edje_embryo_fn_set_state(Embryo_Program *ep, Embryo_Cell *params) { if (rp->program) _edje_program_end(ed, rp->program); _edje_part_description_apply(ed, rp, state, value, NULL, 0.0); - _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, ZERO); + _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, ZERO, ZERO, ZERO); _edje_recalc(ed); } return 0; @@ -928,7 +928,7 @@ _edje_embryo_fn_set_tween_state(Embryo_Program *ep, Embryo_Cell *params) { if (rp->program) _edje_program_end(ed, rp->program); _edje_part_description_apply(ed, rp, state1, value1, state2, value2); - _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, FROM_DOUBLE(tween)); + _edje_part_pos_set(ed, rp, EDJE_TWEEN_MODE_LINEAR, FROM_DOUBLE(tween), ZERO, ZERO); _edje_recalc(ed); } return 0; diff --git a/src/lib/edje_lua.c b/src/lib/edje_lua.c index 3776fbc..d431d75 100644 --- a/src/lib/edje_lua.c +++ b/src/lib/edje_lua.c @@ -3761,7 +3761,7 @@ _edje_lua_part_set_state(lua_State *L) _edje_part_description_apply(obj->ed, obj->rp, luaL_checkstring(L, -2), luaL_checknumber(L, -1), NULL, 0.0); - _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, ZERO); + _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, ZERO, ZERO, ZERO); _edje_recalc(obj->ed); return 0; } @@ -3780,7 +3780,7 @@ _edje_lua_part_set_tween_state(lua_State *L) luaL_checkstring(L, -4), luaL_checknumber(L, -3), luaL_checkstring(L, -2), luaL_checknumber(L, -1)); _edje_part_pos_set(obj->ed, obj->rp, EDJE_TWEEN_MODE_LINEAR, - FROM_DOUBLE(luaL_checknumber(L, -5))); + FROM_DOUBLE(luaL_checknumber(L, -5)), ZERO, ZERO); _edje_recalc(obj->ed); return 0; } diff --git a/src/lib/edje_private.h b/src/lib/edje_private.h index a2e8e9e..2bd70e9 100644 --- a/src/lib/edje_private.h +++ b/src/lib/edje_private.h @@ -544,6 +544,8 @@ struct _Edje_Program /* a conditional program to be run */ struct { int mode; /* how to tween - linear, sinusoidal etc. */ FLOAT_T time; /* time to graduate between current and new state */ + FLOAT_T v1; /* other value for drag actions */ + FLOAT_T v2; /* other value for drag actions */ } tween; Eina_List *targets; /* list of target parts to apply the state to */ @@ -1455,7 +1457,7 @@ extern Eina_Mempool *_emp_TABLE; extern Eina_Mempool *_emp_EXTERNAL; extern Eina_Mempool *_emp_part; -void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos); +void _edje_part_pos_set(Edje *ed, Edje_Real_Part *ep, int mode, FLOAT_T pos, FLOAT_T v1, FLOAT_T v2); Edje_Part_Description_Common *_edje_part_description_find(Edje *ed, Edje_Real_Part *rp, const char *name, double val); diff --git a/src/lib/edje_program.c b/src/lib/edje_program.c index ba8b7e6..feeb88c 100644 --- a/src/lib/edje_program.c +++ b/src/lib/edje_program.c @@ -294,7 +294,9 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) { rp = ed->table_parts[pt->id % ed->table_parts_size]; if (rp) _edje_part_pos_set(ed, rp, - runp->program->tween.mode, t); + runp->program->tween.mode, t, + runp->program->tween.v1, + runp->program->tween.v2); } } if (t >= FROM_INT(1)) @@ -314,7 +316,9 @@ _edje_program_run_iterate(Edje_Running_Program *runp, double tim) NULL, 0.0); _edje_part_pos_set(ed, rp, - runp->program->tween.mode, ZERO); + runp->program->tween.mode, ZERO, + runp->program->tween.v1, + runp->program->tween.v2); rp->program = NULL; } } @@ -389,7 +393,9 @@ _edje_program_end(Edje *ed, Edje_Running_Program *runp) NULL, 0.0); _edje_part_pos_set(ed, rp, - runp->program->tween.mode, ZERO); + runp->program->tween.mode, ZERO, + runp->program->tween.v1, + runp->program->tween.v2); rp->program = NULL; } } @@ -479,7 +485,9 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, rp->param1.description->state.value, pr->state, pr->value); - _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO); + _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, + pr->tween.v1, + pr->tween.v2); rp->program = runp; } } @@ -516,7 +524,9 @@ _edje_program_run(Edje *ed, Edje_Program *pr, Eina_Bool force, const char *ssig, pr->value, NULL, 0.0); - _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO); + _edje_part_pos_set(ed, rp, pr->tween.mode, ZERO, + pr->tween.v1, + pr->tween.v2); } } } -- 2.7.4