1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
#include "efl_canvas_animation_translate_private.h"
#define MY_CLASS EFL_CANVAS_ANIMATION_TRANSLATE_CLASS
typedef struct __Translate_Property_Double
{
double x;
double y;
} _Translate_Property_Double;
EOLIAN static void
_efl_canvas_animation_translate_translate_set(Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Translate_Data *pd,
Eina_Position2D from,
Eina_Position2D to)
{
pd->from = from;
pd->to = to;
pd->use_rel_move = EINA_TRUE;
}
EOLIAN static void
_efl_canvas_animation_translate_translate_get(const Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Translate_Data *pd,
Eina_Position2D *from,
Eina_Position2D *to)
{
if (!pd->use_rel_move)
{
ERR("Animation is done in absolute value.");
return;
}
if (from)
*from = pd->from;
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,
Eina_Position2D from,
Eina_Position2D to)
{
pd->from = from;
pd->to = to;
pd->use_rel_move = EINA_FALSE;
}
EOLIAN static void
_efl_canvas_animation_translate_translate_absolute_get(const Eo *eo_obj EINA_UNUSED,
Efl_Canvas_Animation_Translate_Data *pd,
Eina_Position2D *from,
Eina_Position2D *to)
{
if (pd->use_rel_move)
{
ERR("Animation is done in absolute value.");
return;
}
if (from)
*from = pd->from;
if (to)
*to = pd->to;
}
EOLIAN static double
_efl_canvas_animation_translate_efl_canvas_animation_animation_apply(Eo *eo_obj,
Efl_Canvas_Animation_Translate_Data *pd,
double progress,
Efl_Canvas_Object *target)
{
_Translate_Property_Double new;
Eina_Rect geometry;
progress = efl_animation_apply(efl_super(eo_obj, MY_CLASS), progress, target);
if (!target) return progress;
if (pd->use_rel_move)
{
new.x = GET_STATUS(pd->from.x, pd->to.x, progress);
new.y = GET_STATUS(pd->from.y, pd->to.y, progress);
}
else
{
geometry = efl_gfx_entity_geometry_get(target);
new.x = GET_STATUS(pd->from.x, pd->to.x, progress) - geometry.x;
new.y = GET_STATUS(pd->from.y, pd->to.y, progress) - geometry.y;
}
efl_gfx_mapping_translate(target, new.x, new.y, 0.0);
return progress;
}
EOLIAN static Efl_Object *
_efl_canvas_animation_translate_efl_object_constructor(Eo *eo_obj,
Efl_Canvas_Animation_Translate_Data *pd)
{
eo_obj = efl_constructor(efl_super(eo_obj, MY_CLASS));
pd->from = EINA_POSITION2D(0,0);
pd->to = EINA_POSITION2D(0,0);
pd->use_rel_move = EINA_TRUE;
return eo_obj;
}
#include "efl_canvas_animation_translate.eo.c"
|