summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-05-19 16:54:31 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-05-25 21:24:09 +0900
commit898a86c49e0dfa519dc6bfaf6630b565d6a18851 (patch)
tree49742fea7be8ec6524430716b76bd83a14c645fc
parent7a41ad992dcaa8f55b78fddc33a86a05ea6b223f (diff)
downloadefl-898a86c49e0dfa519dc6bfaf6630b565d6a18851.tar.gz
efl_animation: Add efl_animation_dup()
efl_animation_dup() creates a new animation and copies the properties of the given animation to the newly created animation.
-rw-r--r--src/lib/evas/canvas/efl_animation.eo5
-rw-r--r--src/lib/evas/canvas/efl_animation_alpha.c24
-rw-r--r--src/lib/evas/canvas/efl_animation_alpha.eo1
-rw-r--r--src/lib/evas/canvas/efl_animation_rotate.c37
-rw-r--r--src/lib/evas/canvas/efl_animation_rotate.eo1
-rw-r--r--src/lib/evas/canvas/efl_animation_scale.c32
-rw-r--r--src/lib/evas/canvas/efl_animation_scale.eo1
-rw-r--r--src/lib/evas/canvas/efl_animation_translate.c40
-rw-r--r--src/lib/evas/canvas/efl_animation_translate.eo1
-rw-r--r--src/lib/evas/canvas/evas_object_main.c3
10 files changed, 144 insertions, 1 deletions
diff --git a/src/lib/evas/canvas/efl_animation.eo b/src/lib/evas/canvas/efl_animation.eo
index 61eda2bae2..08e8a62009 100644
--- a/src/lib/evas/canvas/efl_animation.eo
+++ b/src/lib/evas/canvas/efl_animation.eo
@@ -49,10 +49,15 @@ abstract Efl.Animation (Efl.Object)
[[Get the state of animation]]
return: Efl.Animation.State; [[Animation state]]
}
+ dup {
+ [[Duplicate animation]]
+ return: Efl.Animation; [[Duplicated animation]]
+ }
}
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ @empty .dup;
}
events {
animate; [[Animation is animated.]]
diff --git a/src/lib/evas/canvas/efl_animation_alpha.c b/src/lib/evas/canvas/efl_animation_alpha.c
index 65b144415b..a7206840e7 100644
--- a/src/lib/evas/canvas/efl_animation_alpha.c
+++ b/src/lib/evas/canvas/efl_animation_alpha.c
@@ -52,6 +52,30 @@ _efl_animation_alpha_alpha_get(Eo *eo_obj EINA_UNUSED, Evas_Object_Animation_Alp
*to_alpha = pd->to.alpha;
}
+EOLIAN static Efl_Animation *
+_efl_animation_alpha_efl_animation_dup(Eo *eo_obj, Evas_Object_Animation_Alpha_Data *pd)
+{
+ EFL_ANIMATION_ALPHA_CHECK_OR_RETURN(eo_obj, NULL);
+
+ Efl_Animation_Alpha *animation = efl_add(MY_CLASS, NULL);
+
+ double duration = efl_animation_duration_get(eo_obj);
+ efl_animation_duration_set(animation, duration);
+
+ Eo *target = efl_animation_target_get(eo_obj);
+ efl_animation_target_set(animation, target);
+
+ Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
+ efl_animation_final_state_keep_set(animation, state_keep);
+
+ EFL_ANIMATION_ALPHA_DATA_GET(animation, new_pd);
+
+ new_pd->from.alpha = pd->from.alpha;
+ new_pd->to.alpha = pd->to.alpha;
+
+ return animation;
+}
+
static void
_pre_animate_cb(void *data EINA_UNUSED, const Efl_Event *event)
{
diff --git a/src/lib/evas/canvas/efl_animation_alpha.eo b/src/lib/evas/canvas/efl_animation_alpha.eo
index ff59aa5854..235cb7c7e7 100644
--- a/src/lib/evas/canvas/efl_animation_alpha.eo
+++ b/src/lib/evas/canvas/efl_animation_alpha.eo
@@ -20,5 +20,6 @@ class Efl.Animation.Alpha (Efl.Animation)
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ Efl.Animation.dup;
}
}
diff --git a/src/lib/evas/canvas/efl_animation_rotate.c b/src/lib/evas/canvas/efl_animation_rotate.c
index 02550675bd..7d90bab75f 100644
--- a/src/lib/evas/canvas/efl_animation_rotate.c
+++ b/src/lib/evas/canvas/efl_animation_rotate.c
@@ -18,6 +18,9 @@
} \
} while (0)
+#define EFL_ANIMATION_ROTATE_DATA_GET(o, pd) \
+ Evas_Object_Animation_Rotate_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_ROTATE_CLASS)
+
typedef struct _Evas_Object_Animation_Rotate_Property
{
double angle;
@@ -119,6 +122,40 @@ _efl_animation_rotate_absolute_pivot_get(Eo *eo_obj, Evas_Object_Animation_Rotat
*pivot_z = pd->abs_pivot.z;
}
+EOLIAN static Efl_Animation *
+_efl_animation_rotate_efl_animation_dup(Eo *eo_obj, Evas_Object_Animation_Rotate_Data *pd)
+{
+ EFL_ANIMATION_ROTATE_CHECK_OR_RETURN(eo_obj, NULL);
+
+ Efl_Animation_Rotate *animation = efl_add(MY_CLASS, NULL);
+
+ double duration = efl_animation_duration_get(eo_obj);
+ efl_animation_duration_set(animation, duration);
+
+ Eo *target = efl_animation_target_get(eo_obj);
+ efl_animation_target_set(animation, target);
+
+ Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
+ efl_animation_final_state_keep_set(animation, state_keep);
+
+ EFL_ANIMATION_ROTATE_DATA_GET(animation, new_pd);
+
+ new_pd->from.angle = pd->from.angle;
+ new_pd->to.angle = pd->to.angle;
+
+ new_pd->rel_pivot.x = pd->rel_pivot.x;
+ new_pd->rel_pivot.y = pd->rel_pivot.y;
+ new_pd->rel_pivot.z = pd->rel_pivot.z;
+
+ new_pd->abs_pivot.x = pd->rel_pivot.x;
+ new_pd->abs_pivot.y = pd->rel_pivot.y;
+ new_pd->abs_pivot.z = pd->rel_pivot.z;
+
+ new_pd->use_rel_pivot = pd->use_rel_pivot;
+
+ return animation;
+}
+
static void
_pre_animate_cb(void *data, const Efl_Event *event)
{
diff --git a/src/lib/evas/canvas/efl_animation_rotate.eo b/src/lib/evas/canvas/efl_animation_rotate.eo
index 3b786ac61f..05408e5059 100644
--- a/src/lib/evas/canvas/efl_animation_rotate.eo
+++ b/src/lib/evas/canvas/efl_animation_rotate.eo
@@ -42,5 +42,6 @@ class Efl.Animation.Rotate (Efl.Animation)
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ Efl.Animation.dup;
}
}
diff --git a/src/lib/evas/canvas/efl_animation_scale.c b/src/lib/evas/canvas/efl_animation_scale.c
index 9fa76a2a9c..36c2747d2b 100644
--- a/src/lib/evas/canvas/efl_animation_scale.c
+++ b/src/lib/evas/canvas/efl_animation_scale.c
@@ -18,6 +18,9 @@
} \
} while (0)
+#define EFL_ANIMATION_SCALE_DATA_GET(o, pd) \
+ Evas_Object_Animation_Scale_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_SCALE_CLASS)
+
typedef struct _Evas_Object_Animation_Scale_Property
{
double scale_x, scale_y, scale_z;
@@ -121,6 +124,35 @@ _efl_animation_scale_scale_z_get(Eo *eo_obj, Evas_Object_Animation_Scale_Data *p
*to_z = pd->to.scale_z;
}
+EOLIAN static Efl_Animation *
+_efl_animation_scale_efl_animation_dup(Eo *eo_obj, Evas_Object_Animation_Scale_Data *pd)
+{
+ EFL_ANIMATION_SCALE_CHECK_OR_RETURN(eo_obj, NULL);
+
+ Efl_Animation_Scale *animation = efl_add(MY_CLASS, NULL);
+
+ double duration = efl_animation_duration_get(eo_obj);
+ efl_animation_duration_set(animation, duration);
+
+ Eo *target = efl_animation_target_get(eo_obj);
+ efl_animation_target_set(animation, target);
+
+ Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
+ efl_animation_final_state_keep_set(animation, state_keep);
+
+ EFL_ANIMATION_SCALE_DATA_GET(animation, new_pd);
+
+ new_pd->from.scale_x = pd->from.scale_x;
+ new_pd->from.scale_y = pd->from.scale_y;
+ new_pd->from.scale_z = pd->from.scale_z;
+
+ new_pd->to.scale_x = pd->to.scale_x;
+ new_pd->to.scale_y = pd->to.scale_y;
+ new_pd->to.scale_z = pd->to.scale_z;
+
+ return animation;
+}
+
static void
_pre_animate_cb(void *data, const Efl_Event *event)
{
diff --git a/src/lib/evas/canvas/efl_animation_scale.eo b/src/lib/evas/canvas/efl_animation_scale.eo
index ace04bf202..79e44eb307 100644
--- a/src/lib/evas/canvas/efl_animation_scale.eo
+++ b/src/lib/evas/canvas/efl_animation_scale.eo
@@ -50,5 +50,6 @@ class Efl.Animation.Scale (Efl.Animation)
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ Efl.Animation.dup;
}
}
diff --git a/src/lib/evas/canvas/efl_animation_translate.c b/src/lib/evas/canvas/efl_animation_translate.c
index 2670ac344e..b697b0008b 100644
--- a/src/lib/evas/canvas/efl_animation_translate.c
+++ b/src/lib/evas/canvas/efl_animation_translate.c
@@ -18,6 +18,9 @@
} \
} while (0)
+#define EFL_ANIMATION_TRANSLATE_DATA_GET(o, pd) \
+ Evas_Object_Animation_Translate_Data *pd = efl_data_scope_get(o, EFL_ANIMATION_TRANSLATE_CLASS)
+
typedef struct _Evas_Object_Animation_Translate_Property
{
Evas_Coord move_x, move_y, move_z;
@@ -230,6 +233,43 @@ _efl_animation_translate_coordinate_z_get(Eo *eo_obj, Evas_Object_Animation_Tran
*to_z = pd->to.z;
}
+EOLIAN static Efl_Animation *
+_efl_animation_translate_efl_animation_dup(Eo *eo_obj, Evas_Object_Animation_Translate_Data *pd)
+{
+ EFL_ANIMATION_TRANSLATE_CHECK_OR_RETURN(eo_obj, NULL);
+
+ Efl_Animation_Translate *animation = efl_add(MY_CLASS, NULL);
+
+ double duration = efl_animation_duration_get(eo_obj);
+ efl_animation_duration_set(animation, duration);
+
+ Eo *target = efl_animation_target_get(eo_obj);
+ efl_animation_target_set(animation, target);
+
+ Eina_Bool state_keep = efl_animation_final_state_keep_get(eo_obj);
+ efl_animation_final_state_keep_set(animation, state_keep);
+
+ EFL_ANIMATION_TRANSLATE_DATA_GET(animation, new_pd);
+
+ new_pd->from.move_x = pd->from.move_x;
+ new_pd->from.move_y = pd->from.move_y;
+ new_pd->from.move_z = pd->from.move_z;
+
+ new_pd->from.x = pd->from.x;
+ new_pd->from.y = pd->from.y;
+ new_pd->from.z = pd->from.z;
+
+ new_pd->to.move_x = pd->to.move_x;
+ new_pd->to.move_y = pd->to.move_y;
+ new_pd->to.move_z = pd->to.move_z;
+
+ new_pd->to.x = pd->to.x;
+ new_pd->to.y = pd->to.y;
+ new_pd->to.z = pd->to.z;
+
+ return animation;
+}
+
static void
_pre_animate_cb(void *data, const Efl_Event *event)
{
diff --git a/src/lib/evas/canvas/efl_animation_translate.eo b/src/lib/evas/canvas/efl_animation_translate.eo
index d187dad896..85d4bf799a 100644
--- a/src/lib/evas/canvas/efl_animation_translate.eo
+++ b/src/lib/evas/canvas/efl_animation_translate.eo
@@ -98,5 +98,6 @@ class Efl.Animation.Translate (Efl.Animation)
implements {
Efl.Object.constructor;
Efl.Object.destructor;
+ Efl.Animation.dup;
}
}
diff --git a/src/lib/evas/canvas/evas_object_main.c b/src/lib/evas/canvas/evas_object_main.c
index de494449ca..de68f9b340 100644
--- a/src/lib/evas/canvas/evas_object_main.c
+++ b/src/lib/evas/canvas/evas_object_main.c
@@ -2783,7 +2783,8 @@ _efl_canvas_object_event_animation_set(Eo *eo_obj,
if (!event_anim) return;
Efl_Animation *cur_anim = event_anim->anim;
- Efl_Animation *new_anim = animation;
+ Efl_Animation *new_anim = NULL;
+ if (animation) new_anim = efl_animation_dup(animation);
//Unset for current event animation
if (cur_anim)