forked from enlightenment/efl
efl_canvas_animation_translate: move from x&y to container types
Summary: this now uses Eina.Position2D so its easier to pass arround other positions. ref T8288 Depends on D10559 Reviewers: segfaultxavi Reviewed By: segfaultxavi Subscribers: segfaultxavi, cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: T8288 Differential Revision: https://phab.enlightenment.org/D10562
This commit is contained in:
parent
e2a011f56b
commit
a1a77f5590
|
@ -199,7 +199,7 @@ test_efl_anim_interpolator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
|
||||
Efl_Canvas_Animation *anim =
|
||||
efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_set(anim, 0, 0, (WIN_W - BTN_W), 0);
|
||||
efl_animation_translate_set(anim, EINA_POSITION2D(0, 0), EINA_POSITION2D((WIN_W - BTN_W), 0));
|
||||
efl_animation_duration_set(anim, 2.0);
|
||||
efl_animation_final_state_keep_set(anim, EINA_FALSE);
|
||||
|
||||
|
|
|
@ -84,13 +84,13 @@ test_efl_anim_translate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
|
|||
|
||||
//Translate Animation to right bottom relatively
|
||||
Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_set(translate_rb_anim, 0, 0, 100, 100);
|
||||
efl_animation_translate_set(translate_rb_anim, EINA_POSITION2D(0, 0), EINA_POSITION2D(100, 100));
|
||||
efl_animation_duration_set(translate_rb_anim, 1.0);
|
||||
efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE);
|
||||
|
||||
//Translate Animation to left top relatively
|
||||
Efl_Canvas_Animation *translate_lt_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_set(translate_lt_anim, 100, 100, 0, 0);
|
||||
efl_animation_translate_set(translate_lt_anim, EINA_POSITION2D(100, 100), EINA_POSITION2D(0, 0));
|
||||
efl_animation_duration_set(translate_lt_anim, 1.0);
|
||||
efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE);
|
||||
|
||||
|
@ -150,13 +150,13 @@ test_efl_anim_translate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_U
|
|||
|
||||
//Translate Animation to right bottom absolutely
|
||||
Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_absolute_set(translate_rb_anim, 0, 0, 100, 100);
|
||||
efl_animation_translate_absolute_set(translate_rb_anim, EINA_POSITION2D(0, 0), EINA_POSITION2D(100, 100));
|
||||
efl_animation_duration_set(translate_rb_anim, 1.0);
|
||||
efl_animation_final_state_keep_set(translate_rb_anim, EINA_TRUE);
|
||||
|
||||
//Translate Animation to left top absolutely
|
||||
Efl_Canvas_Animation *translate_lt_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
|
||||
efl_animation_translate_absolute_set(translate_lt_anim, 100, 100, 0, 0);
|
||||
efl_animation_translate_absolute_set(translate_lt_anim, EINA_POSITION2D(100, 100), EINA_POSITION2D(0, 0));
|
||||
efl_animation_duration_set(translate_lt_anim, 1.0);
|
||||
efl_animation_final_state_keep_set(translate_lt_anim, EINA_TRUE);
|
||||
|
||||
|
|
|
@ -11,16 +11,12 @@ typedef struct __Translate_Property_Double
|
|||
EOLIAN static void
|
||||
_efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Canvas_Animation_Translate_Data *pd,
|
||||
Evas_Coord from_x,
|
||||
Evas_Coord from_y,
|
||||
Evas_Coord to_x,
|
||||
Evas_Coord to_y)
|
||||
Eina_Position2D from,
|
||||
Eina_Position2D to)
|
||||
{
|
||||
pd->from.move_x = from_x;
|
||||
pd->from.move_y = from_y;
|
||||
pd->from = from;
|
||||
|
||||
pd->to.move_x = to_x;
|
||||
pd->to.move_y = to_y;
|
||||
pd->to = to;
|
||||
|
||||
pd->use_rel_move = EINA_TRUE;
|
||||
}
|
||||
|
@ -28,10 +24,8 @@ _efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
|
|||
EOLIAN static void
|
||||
_efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Canvas_Animation_Translate_Data *pd,
|
||||
Evas_Coord *from_x,
|
||||
Evas_Coord *from_y,
|
||||
Evas_Coord *to_x,
|
||||
Evas_Coord *to_y)
|
||||
Eina_Position2D *from,
|
||||
Eina_Position2D *to)
|
||||
{
|
||||
if (!pd->use_rel_move)
|
||||
{
|
||||
|
@ -39,30 +33,22 @@ _efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED,
|
|||
return;
|
||||
}
|
||||
|
||||
if (from_x)
|
||||
*from_x = pd->from.move_x;
|
||||
if (from_y)
|
||||
*from_y = pd->from.move_y;
|
||||
if (from)
|
||||
*from = pd->from;
|
||||
|
||||
if (to_x)
|
||||
*to_x = pd->to.move_x;
|
||||
if (to_y)
|
||||
*to_y = pd->to.move_y;
|
||||
if (to)
|
||||
*to = pd->to;
|
||||
}
|
||||
|
||||
EOLIAN static void
|
||||
_efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Canvas_Animation_Translate_Data *pd,
|
||||
Evas_Coord from_x,
|
||||
Evas_Coord from_y,
|
||||
Evas_Coord to_x,
|
||||
Evas_Coord to_y)
|
||||
Eina_Position2D from,
|
||||
Eina_Position2D to)
|
||||
{
|
||||
pd->from.x = from_x;
|
||||
pd->from.y = from_y;
|
||||
pd->from = from;
|
||||
|
||||
pd->to.x = to_x;
|
||||
pd->to.y = to_y;
|
||||
pd->to = to;
|
||||
|
||||
pd->use_rel_move = EINA_FALSE;
|
||||
}
|
||||
|
@ -70,10 +56,8 @@ _efl_canvas_animation_translate_translate_absolute_set(Eo *eo_obj EINA_UNUSED,
|
|||
EOLIAN static void
|
||||
_efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNUSED,
|
||||
Efl_Canvas_Animation_Translate_Data *pd,
|
||||
Evas_Coord *from_x,
|
||||
Evas_Coord *from_y,
|
||||
Evas_Coord *to_x,
|
||||
Evas_Coord *to_y)
|
||||
Eina_Position2D *from,
|
||||
Eina_Position2D *to)
|
||||
{
|
||||
if (pd->use_rel_move)
|
||||
{
|
||||
|
@ -81,15 +65,11 @@ _efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNU
|
|||
return;
|
||||
}
|
||||
|
||||
if (from_x)
|
||||
*from_x = pd->from.x;
|
||||
if (from_y)
|
||||
*from_y = pd->from.y;
|
||||
if (from)
|
||||
*from = pd->from;
|
||||
|
||||
if (to_x)
|
||||
*to_x = pd->to.x;
|
||||
if (to_y)
|
||||
*to_y = pd->to.y;
|
||||
if (to)
|
||||
*to = pd->to;
|
||||
}
|
||||
|
||||
EOLIAN static double
|
||||
|
@ -106,8 +86,8 @@ _efl_canvas_animation_translate_efl_canvas_animation_animation_apply(Eo *eo_obj,
|
|||
|
||||
if (pd->use_rel_move)
|
||||
{
|
||||
new.x = GET_STATUS(pd->from.move_x, pd->to.move_x, progress);
|
||||
new.y = GET_STATUS(pd->from.move_y, pd->to.move_y, progress);
|
||||
new.x = GET_STATUS(pd->from.x, pd->to.x, progress);
|
||||
new.y = GET_STATUS(pd->from.y, pd->to.y, progress);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -127,15 +107,8 @@ _efl_canvas_animation_translate_efl_object_constructor(Eo *eo_obj,
|
|||
{
|
||||
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
|
||||
|
||||
pd->from.move_x = 0;
|
||||
pd->from.move_y = 0;
|
||||
pd->from.x = 0;
|
||||
pd->from.y = 0;
|
||||
|
||||
pd->to.move_x = 0;
|
||||
pd->to.move_y = 0;
|
||||
pd->to.x = 0;
|
||||
pd->to.y = 0;
|
||||
pd->from = EINA_POSITION2D(0,0);
|
||||
pd->to = EINA_POSITION2D(0,0);
|
||||
|
||||
pd->use_rel_move = EINA_TRUE;
|
||||
|
||||
|
|
|
@ -11,10 +11,8 @@ class @beta Efl.Canvas.Animation_Translate extends Efl.Canvas.Animation
|
|||
get {
|
||||
}
|
||||
values {
|
||||
from_x: int; [[Distance moved along x axis when animation starts]]
|
||||
from_y: int; [[Distance moved along y axis when animation starts]]
|
||||
to_x: int; [[Distance moved along x axis when animation ends]]
|
||||
to_y: int; [[Distance moved along y axis when animation ends]]
|
||||
from : Eina.Position2D; [[Position moved when animation starts.]]
|
||||
to : Eina.Position2D; [[Position moved when animation ends.]]
|
||||
}
|
||||
}
|
||||
@property translate_absolute {
|
||||
|
@ -24,10 +22,8 @@ class @beta Efl.Canvas.Animation_Translate extends Efl.Canvas.Animation
|
|||
get {
|
||||
}
|
||||
values {
|
||||
from_x: int; [[X coordinate when animation starts]]
|
||||
from_y: int; [[Y coordinate when animation starts]]
|
||||
to_x: int; [[X coordinate when animation ends]]
|
||||
to_y: int; [[Y coordinate when animation ends]]
|
||||
from : Eina.Position2D; [[The position where the animation starts.]]
|
||||
to : Eina.Position2D; [[The position where the animation stops.]]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,16 +7,10 @@
|
|||
#define EFL_ANIMATION_TRANSLATE_DATA_GET(o, pd) \
|
||||
Efl_Canvas_Animation_Translate_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_TRANSLATE_CLASS)
|
||||
|
||||
typedef struct _Efl_Canvas_Animation_Translate_Property
|
||||
{
|
||||
Evas_Coord move_x, move_y;
|
||||
Evas_Coord x, y;
|
||||
} Efl_Canvas_Animation_Translate_Property;
|
||||
|
||||
typedef struct _Efl_Canvas_Animation_Translate_Data
|
||||
{
|
||||
Efl_Canvas_Animation_Translate_Property from;
|
||||
Efl_Canvas_Animation_Translate_Property to;
|
||||
Eina_Position2D from;
|
||||
Eina_Position2D to;
|
||||
|
||||
Eina_Bool use_rel_move;
|
||||
} Efl_Canvas_Animation_Translate_Data;
|
||||
|
|
Loading…
Reference in New Issue