//Scale Animation to zoom out
Efl_Canvas_Animation *scale_half_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, NULL, 0.5, 0.5);
+ efl_animation_scale_set(scale_half_anim, EINA_VECTOR2(2.0, 2.0), EINA_VECTOR2(1.0, 1.0), NULL, EINA_VECTOR2(0.5, 0.5));
//Show Parallel Group Animation
Efl_Canvas_Animation *parallel_show_anim = efl_add(EFL_CANVAS_ANIMATION_GROUP_PARALLEL_CLASS, win);
//Scale Animation to zoom in
Efl_Canvas_Animation *scale_double_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, NULL, 0.5, 0.5);
+ efl_animation_scale_set(scale_double_anim, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(2.0, 2.0), NULL, EINA_VECTOR2(0.5, 0.5));
//Hide Parallel Group Animation
Efl_Canvas_Animation *parallel_hide_anim = efl_add(EFL_CANVAS_ANIMATION_GROUP_PARALLEL_CLASS, win);
//Scale Animation to zoom in
Efl_Canvas_Animation *scale_double_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, NULL, 0.5, 0.5);
+ efl_animation_scale_set(scale_double_anim, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(2.0, 2.0), NULL, EINA_VECTOR2(0.5, 0.5));
//Hide Animation
Efl_Canvas_Animation *hide_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win);
//Scale Animation to zoom out
Efl_Canvas_Animation *scale_half_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, NULL, 0.5, 0.5);
+ efl_animation_scale_set(scale_half_anim, EINA_VECTOR2(2.0, 2.0), EINA_VECTOR2(1.0, 1.0), NULL, EINA_VECTOR2(0.5, 0.5));
efl_animation_duration_set(scale_half_anim, 1.0);
//Rotate from 45 to 0 degrees Animation
//Scale Animation to zoom in
Efl_Canvas_Animation *scale_double_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, NULL, 0.5, 0.5);
+ efl_animation_scale_set(scale_double_anim, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(2.0, 2.0), NULL, EINA_VECTOR2(0.5, 0.5));
efl_animation_duration_set(scale_double_anim, 1.0);
efl_animation_final_state_keep_set(scale_double_anim, EINA_TRUE);
//Scale Animation to zoom out
Efl_Canvas_Animation *scale_half_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, NULL, 0.5, 0.5);
+ efl_animation_scale_set(scale_half_anim, EINA_VECTOR2(2.0, 2.0), EINA_VECTOR2(1.0, 1.0), NULL, EINA_VECTOR2(0.5, 0.5));
efl_animation_duration_set(scale_half_anim, 1.0);
efl_animation_final_state_keep_set(scale_half_anim, EINA_TRUE);
//Scale Animation to zoom in
Efl_Canvas_Animation *scale_double_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, pivot, 0.5, 0.5);
+ efl_animation_scale_set(scale_double_anim, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(2.0, 2.0), pivot, EINA_VECTOR2(0.5, 0.5));
efl_animation_duration_set(scale_double_anim, 1.0);
efl_animation_final_state_keep_set(scale_double_anim, EINA_TRUE);
//Scale Animation to zoom out
Efl_Canvas_Animation *scale_half_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, pivot, 0.5, 0.5);
+ efl_animation_scale_set(scale_half_anim, EINA_VECTOR2(2.0, 2.0), EINA_VECTOR2(1.0, 1.0), pivot, EINA_VECTOR2(0.5, 0.5));
efl_animation_duration_set(scale_half_anim, 1.0);
efl_animation_final_state_keep_set(scale_half_anim, EINA_TRUE);
//Scale Animation to zoom in
Efl_Canvas_Animation *scale_double_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_absolute_set(scale_double_anim, 1.0, 1.0, 2.0, 2.0, 0, 0);
+ efl_animation_scale_absolute_set(scale_double_anim, EINA_VECTOR2(1.0, 1.0), EINA_VECTOR2(2.0, 2.0), EINA_POSITION2D(0, 0));
efl_animation_duration_set(scale_double_anim, 1.0);
efl_animation_final_state_keep_set(scale_double_anim, EINA_TRUE);
//Scale Animation to zoom out
Efl_Canvas_Animation *scale_half_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
- efl_animation_scale_absolute_set(scale_half_anim, 2.0, 2.0, 1.0, 1.0, 0, 0);
+ efl_animation_scale_absolute_set(scale_half_anim, EINA_VECTOR2(2.0, 2.0), EINA_VECTOR2(1.0, 1.0), EINA_POSITION2D(0, 0));
efl_animation_duration_set(scale_half_anim, 1.0);
efl_animation_final_state_keep_set(scale_half_anim, EINA_TRUE);
EOLIAN static void
_efl_canvas_animation_scale_scale_set(Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Scale_Data *pd,
- double from_scale_x,
- double from_scale_y,
- double to_scale_x,
- double to_scale_y,
+ Eina_Vector2 from_scale,
+ Eina_Vector2 to_scale,
Efl_Canvas_Object *pivot,
- double cx,
- double cy)
+ Eina_Vector2 rel_pivot_pos)
{
- pd->from.scale_x = from_scale_x;
- pd->from.scale_y = from_scale_y;
+ pd->from = from_scale;
- pd->to.scale_x = to_scale_x;
- pd->to.scale_y = to_scale_y;
+ pd->to = to_scale;
pd->rel_pivot.obj = pivot;
- pd->rel_pivot.cx = cx;
- pd->rel_pivot.cy = cy;
+ pd->rel_pivot.pos = rel_pivot_pos;
pd->use_rel_pivot = EINA_TRUE;
}
EOLIAN static void
-_efl_canvas_animation_scale_scale_get(const Eo *eo_obj EINA_UNUSED,
- Efl_Canvas_Animation_Scale_Data *pd,
- double *from_scale_x,
- double *from_scale_y,
- double *to_scale_x,
- double *to_scale_y,
- Efl_Canvas_Object **pivot,
- double *cx,
- double *cy)
+_efl_canvas_animation_scale_scale_get(const Eo *obj EINA_UNUSED,
+ Efl_Canvas_Animation_Scale_Data *pd,
+ Eina_Vector2 *from_scale, Eina_Vector2 *to_scale,
+ Efl_Canvas_Object **pivot, Eina_Vector2 *pivot_pos)
{
if (!pd->use_rel_pivot)
{
return;
}
- if (from_scale_x)
- *from_scale_x = pd->from.scale_x;
-
- if (from_scale_y)
- *from_scale_y = pd->from.scale_y;
-
- if (to_scale_x)
- *to_scale_x = pd->to.scale_x;
+ if (from_scale)
+ *from_scale = pd->from;
- if (to_scale_y)
- *to_scale_y = pd->to.scale_y;
+ if (to_scale)
+ *to_scale = pd->to;
if (pivot)
*pivot = pd->rel_pivot.obj;
- if (cx)
- *cx = pd->rel_pivot.cx;
-
- if (cy)
- *cy = pd->rel_pivot.cy;
+ if (pivot_pos)
+ *pivot_pos = pd->rel_pivot.pos;
}
EOLIAN static void
-_efl_canvas_animation_scale_scale_absolute_set(Eo *eo_obj EINA_UNUSED,
- Efl_Canvas_Animation_Scale_Data *pd,
- double from_scale_x,
- double from_scale_y,
- double to_scale_x,
- double to_scale_y,
- Evas_Coord cx,
- Evas_Coord cy)
+_efl_canvas_animation_scale_scale_absolute_set(Eo *obj EINA_UNUSED,
+ Efl_Canvas_Animation_Scale_Data *pd,
+ Eina_Vector2 from_scale, Eina_Vector2 to_scale,
+ Eina_Position2D pos)
{
- pd->from.scale_x = from_scale_x;
- pd->from.scale_y = from_scale_y;
+ pd->from = from_scale;
- pd->to.scale_x = to_scale_x;
- pd->to.scale_y = to_scale_y;
+ pd->to = to_scale;
- pd->abs_pivot.cx = cx;
- pd->abs_pivot.cy = cy;
+ pd->pos = pos;
pd->use_rel_pivot = EINA_FALSE;
}
EOLIAN static void
-_efl_canvas_animation_scale_scale_absolute_get(const Eo *eo_obj EINA_UNUSED,
- Efl_Canvas_Animation_Scale_Data *pd,
- double *from_scale_x,
- double *from_scale_y,
- double *to_scale_x,
- double *to_scale_y,
- Evas_Coord *cx,
- Evas_Coord *cy)
+_efl_canvas_animation_scale_scale_absolute_get(const Eo *obj EINA_UNUSED,
+ Efl_Canvas_Animation_Scale_Data *pd,
+ Eina_Vector2 *from_scale, Eina_Vector2 *to_scale,
+ Eina_Position2D *pos)
{
if (pd->use_rel_pivot)
{
return;
}
- if (from_scale_x)
- *from_scale_x = pd->from.scale_x;
-
- if (from_scale_y)
- *from_scale_y = pd->from.scale_y;
+ if (from_scale)
+ *from_scale = pd->from;
- if (to_scale_x)
- *to_scale_x = pd->to.scale_x;
+ if (to_scale)
+ *to_scale = pd->to;
- if (to_scale_y)
- *to_scale_y = pd->to.scale_y;
-
- if (cx)
- *cx = pd->abs_pivot.cx;
-
- if (cy)
- *cy = pd->abs_pivot.cy;
+ if (pos)
+ *pos = pd->pos;
}
EOLIAN static double
double progress,
Efl_Canvas_Object *target)
{
- Efl_Canvas_Animation_Scale_Property new_scale;
+ Eina_Vector2 new_scale;
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
if (!target) return progress;
- new_scale.scale_x = GET_STATUS(pd->from.scale_x, pd->to.scale_x, progress);
- new_scale.scale_y = GET_STATUS(pd->from.scale_y, pd->to.scale_y, progress);
+ new_scale.x = GET_STATUS(pd->from.x, pd->to.x, progress);
+ new_scale.y = GET_STATUS(pd->from.y, pd->to.y, progress);
if (pd->use_rel_pivot)
{
efl_gfx_mapping_zoom(target,
- new_scale.scale_x, new_scale.scale_y,
+ new_scale.x, new_scale.y,
(pd->rel_pivot.obj) ? pd->rel_pivot.obj : target,
- pd->rel_pivot.cx, pd->rel_pivot.cy);
+ pd->rel_pivot.pos.x , pd->rel_pivot.pos.y);
}
else
{
efl_gfx_mapping_zoom_absolute(target,
- new_scale.scale_x, new_scale.scale_y,
- pd->abs_pivot.cx, pd->abs_pivot.cy);
+ new_scale.x, new_scale.y,
+ pd->pos.x, pd->pos.y);
}
return progress;
{
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
- pd->from.scale_x = 1.0;
- pd->from.scale_y = 1.0;
- pd->to.scale_x = 1.0;
- pd->to.scale_y = 1.0;
-
+ pd->from = EINA_VECTOR2(1.0, 1.0);
+ pd->to = EINA_VECTOR2(1.0, 1.0);
+ pd->rel_pivot.pos = EINA_VECTOR2(0.5, 0.5);
pd->rel_pivot.obj = NULL;
- pd->rel_pivot.cx = 0.5;
- pd->rel_pivot.cy = 0.5;
-
- pd->abs_pivot.cx = 0;
- pd->abs_pivot.cy = 0;
+ pd->pos = EINA_POSITION2D(0, 0);
pd->use_rel_pivot = EINA_TRUE;
get {
}
values {
- from_scale_x: double; [[Scale factor along x axis when animation starts]]
- from_scale_y: double; [[Scale factor along y axis when animation starts]]
- to_scale_x: double; [[Scale factor along x axis when animation ends]]
- to_scale_y: double; [[Scale factor along y axis when animation ends]]
+ from_scale : Eina.Vector2; [[Scale factor when animation starts]]
+ to_scale : Eina.Vector2; [[Scale factor when animation ends]]
pivot: Efl.Canvas.Object; [[Pivot object for the center point. If the pivot object is $NULL, then the object
is scaled on itself.]]
- cx: double; [[X relative coordinate of the center point. The left end is 0.0 and the right end is 1.0
- (the center is 0.5).]]
- cy: double; [[Y relative coordinate of the center point. The top end is 0.0 and the bottom end is 1.0
- (the center is 0.5).]]
+ pivot_pos : Eina.Vector2; [[Relative coordinates of the center point. 0.0,0.0 is upper left.]]
}
}
@property scale_absolute {
get {
}
values {
- from_scale_x: double; [[Scale factor along x axis when animation starts]]
- from_scale_y: double; [[Scale factor along y axis when animation starts]]
- to_scale_x: double; [[Scale factor along x axis when animation ends]]
- to_scale_y: double; [[Scale factor along y axis when animation ends]]
- cx: int; [[X absolute coordinate of the center point.]]
- cy: int; [[Y absolute coordinate of the center point.]]
+ from_scale : Eina.Vector2; [[Scale factor when animation starts]]
+ to_scale : Eina.Vector2; [[Scale factor when animation ends]]
+ pos : Eina.Position2D; [[Absolut coordinates in canvas space]]
}
}
}
#define EFL_ANIMATION_SCALE_DATA_GET(o, pd) \
Efl_Canvas_Animation_Scale_Data *pd = efl_data_scope_get(o, EFL_CANVAS_ANIMATION_SCALE_CLASS)
-typedef struct _Efl_Canvas_Animation_Scale_Property
-{
- double scale_x, scale_y;
-} Efl_Canvas_Animation_Scale_Property;
-
-typedef struct _Efl_Canvas_Animation_Scale_Absolute_Pivot
-{
- Evas_Coord cx, cy;
-} Efl_Canvas_Animation_Scale_Absolute_Pivot;
-
typedef struct _Efl_Canvas_Animation_Scale_Relative_Pivot
{
Efl_Canvas_Object *obj;
- double cx, cy;
+ Eina_Vector2 pos;
} Efl_Canvas_Animation_Scale_Relative_Pivot;
typedef struct _Efl_Canvas_Animation_Scale_Data
{
- Efl_Canvas_Animation_Scale_Property from;
- Efl_Canvas_Animation_Scale_Property to;
+ Eina_Vector2 from;
+ Eina_Vector2 to;
- Efl_Canvas_Animation_Scale_Absolute_Pivot abs_pivot;
+ Eina_Position2D pos;
Efl_Canvas_Animation_Scale_Relative_Pivot rel_pivot;
Eina_Bool use_rel_pivot;