summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-09-05 11:33:58 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-10-12 21:03:49 +0900
commite83facfb37dc22ead7d3c5c66c4dcaa33252dd61 (patch)
treef27588a20328480bedd6e17370258b18a74fcb85
parent595f47e202c1946d27bb0c39868a9bf8f4b98d78 (diff)
efl_animation: Add repeat_mode property
To not display original state when the reverse repeat starts, the animators in group parallel and group sequential are deleted.
-rw-r--r--src/bin/elementary/test_efl_anim_repeat.c54
-rw-r--r--src/lib/evas/Evas_Internal.h9
-rw-r--r--src/lib/evas/canvas/efl_animation.c21
-rw-r--r--src/lib/evas/canvas/efl_animation.eo9
-rw-r--r--src/lib/evas/canvas/efl_animation_alpha.c4
-rw-r--r--src/lib/evas/canvas/efl_animation_group_parallel.c4
-rw-r--r--src/lib/evas/canvas/efl_animation_group_sequential.c4
-rw-r--r--src/lib/evas/canvas/efl_animation_object.c49
-rw-r--r--src/lib/evas/canvas/efl_animation_object_group_parallel.c19
-rw-r--r--src/lib/evas/canvas/efl_animation_object_group_sequential.c23
-rw-r--r--src/lib/evas/canvas/efl_animation_object_private.h39
-rw-r--r--src/lib/evas/canvas/efl_animation_private.h15
-rw-r--r--src/lib/evas/canvas/efl_animation_rotate.c4
-rw-r--r--src/lib/evas/canvas/efl_animation_scale.c4
-rw-r--r--src/lib/evas/canvas/efl_animation_translate.c4
-rw-r--r--src/lib/evas/canvas/efl_animation_types.eot8
16 files changed, 241 insertions, 29 deletions
diff --git a/src/bin/elementary/test_efl_anim_repeat.c b/src/bin/elementary/test_efl_anim_repeat.c
index 912b239b2a..b5f7ac3ce1 100644
--- a/src/bin/elementary/test_efl_anim_repeat.c
+++ b/src/bin/elementary/test_efl_anim_repeat.c
@@ -9,11 +9,24 @@ typedef struct _App_Data
9 Efl_Animation *hide_anim; 9 Efl_Animation *hide_anim;
10 Efl_Animation_Object *anim_obj; 10 Efl_Animation_Object *anim_obj;
11 11
12 Evas_Object *start_btn;
12 Evas_Object *repeat_count_spin; 13 Evas_Object *repeat_count_spin;
14 Evas_Object *repeat_mode_spin;
13 15
14 Eina_Bool is_btn_visible; 16 Eina_Bool is_btn_visible;
15} App_Data; 17} App_Data;
16 18
19Efl_Animation_Repeat_Mode
20_anim_repeat_mode_get(Evas_Object *spinner)
21{
22 int value = elm_spinner_value_get(spinner);
23
24 if (value == 0)
25 return EFL_ANIMATION_REPEAT_MODE_RESTART;
26 else
27 return EFL_ANIMATION_REPEAT_MODE_REVERSE;
28}
29
17static void 30static void
18_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 31_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
19{ 32{
@@ -27,7 +40,23 @@ _anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
27 40
28 printf("Animation has been ended!\n"); 41 printf("Animation has been ended!\n");
29 42
43 Efl_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
44 if (repeat_mode == EFL_ANIMATION_REPEAT_MODE_REVERSE)
45 {
46 int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
47 if (repeat_count % 2 == 1)
48 {
49 ad->is_btn_visible = !(ad->is_btn_visible);
50
51 if (ad->is_btn_visible)
52 elm_object_text_set(ad->start_btn, "Start Alpha Animation from 1.0 to 0.0");
53 else
54 elm_object_text_set(ad->start_btn, "Start Alpha Animation from 0.0 to 1.0");
55 }
56 }
57
30 elm_object_disabled_set(ad->repeat_count_spin, EINA_FALSE); 58 elm_object_disabled_set(ad->repeat_count_spin, EINA_FALSE);
59 elm_object_disabled_set(ad->repeat_mode_spin, EINA_FALSE);
31 60
32 ad->anim_obj = NULL; 61 ad->anim_obj = NULL;
33} 62}
@@ -53,11 +82,17 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
53 int repeat_count = elm_spinner_value_get(ad->repeat_count_spin); 82 int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
54 elm_object_disabled_set(ad->repeat_count_spin, EINA_TRUE); 83 elm_object_disabled_set(ad->repeat_count_spin, EINA_TRUE);
55 84
85 Efl_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
86 elm_object_disabled_set(ad->repeat_mode_spin, EINA_TRUE);
87
56 if (ad->is_btn_visible) 88 if (ad->is_btn_visible)
57 { 89 {
58 //Set animation repeat count 90 //Set animation repeat count
59 efl_animation_repeat_count_set(ad->show_anim, repeat_count); 91 efl_animation_repeat_count_set(ad->show_anim, repeat_count);
60 92
93 //Set animation repeat mode
94 efl_animation_repeat_mode_set(ad->show_anim, repeat_mode);
95
61 //Create Animation Object from Animation 96 //Create Animation Object from Animation
62 ad->anim_obj = efl_animation_object_create(ad->show_anim); 97 ad->anim_obj = efl_animation_object_create(ad->show_anim);
63 elm_object_text_set(obj, "Start Alpha Animation from 1.0 to 0.0"); 98 elm_object_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
@@ -67,6 +102,9 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
67 //Set animation repeat count 102 //Set animation repeat count
68 efl_animation_repeat_count_set(ad->hide_anim, repeat_count); 103 efl_animation_repeat_count_set(ad->hide_anim, repeat_count);
69 104
105 //Set animation repeat mode
106 efl_animation_repeat_mode_set(ad->hide_anim, repeat_mode);
107
70 //Create Animation Object from Animation 108 //Create Animation Object from Animation
71 ad->anim_obj = efl_animation_object_create(ad->hide_anim); 109 ad->anim_obj = efl_animation_object_create(ad->hide_anim);
72 elm_object_text_set(obj, "Start Alpha Animation from 0.0 to 1.0"); 110 elm_object_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
@@ -145,15 +183,29 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
145 evas_object_move(repeat_count_spin, 100, 350); 183 evas_object_move(repeat_count_spin, 100, 350);
146 evas_object_show(repeat_count_spin); 184 evas_object_show(repeat_count_spin);
147 185
186 //Spinner to set animation repeat mode
187 Evas_Object *repeat_mode_spin = elm_spinner_add(win);
188 elm_spinner_label_format_set(repeat_mode_spin, "Repeat Mode: %s");
189 elm_spinner_editable_set(repeat_mode_spin, EINA_FALSE);
190 elm_spinner_min_max_set(repeat_mode_spin, 0, 1);
191 elm_spinner_value_set(repeat_mode_spin, 0);
192 elm_spinner_special_value_add(repeat_mode_spin, 0, "Restart");
193 elm_spinner_special_value_add(repeat_mode_spin, 1, "Reverse");
194 evas_object_resize(repeat_mode_spin, 200, 50);
195 evas_object_move(repeat_mode_spin, 100, 400);
196 evas_object_show(repeat_mode_spin);
197
148 198
149 //Initialize App Data 199 //Initialize App Data
150 ad->show_anim = show_anim; 200 ad->show_anim = show_anim;
151 ad->hide_anim = hide_anim; 201 ad->hide_anim = hide_anim;
152 ad->anim_obj = NULL; 202 ad->anim_obj = NULL;
203 ad->start_btn = start_btn;
153 ad->repeat_count_spin = repeat_count_spin; 204 ad->repeat_count_spin = repeat_count_spin;
205 ad->repeat_mode_spin = repeat_mode_spin;
154 ad->is_btn_visible = EINA_TRUE; 206 ad->is_btn_visible = EINA_TRUE;
155 207
156 208
157 evas_object_resize(win, 400, 450); 209 evas_object_resize(win, 400, 500);
158 evas_object_show(win); 210 evas_object_show(win);
159} 211}
diff --git a/src/lib/evas/Evas_Internal.h b/src/lib/evas/Evas_Internal.h
index e57b60163c..d0eb810e04 100644
--- a/src/lib/evas/Evas_Internal.h
+++ b/src/lib/evas/Evas_Internal.h
@@ -101,6 +101,15 @@ EOAPI double efl_animation_object_total_duration_get(const Eo *obj);
101EOAPI void efl_animation_object_start_delay_set(Eo *obj, double delay_time); 101EOAPI void efl_animation_object_start_delay_set(Eo *obj, double delay_time);
102EOAPI double efl_animation_object_start_delay_get(const Eo *obj); 102EOAPI double efl_animation_object_start_delay_get(const Eo *obj);
103 103
104typedef enum
105{
106 EFL_ANIMATION_OBJECT_REPEAT_MODE_RESTART = 0,
107 EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE
108} Efl_Animation_Object_Repeat_Mode;
109
110EOAPI void efl_animation_object_repeat_mode_set(Eo *obj, Efl_Animation_Object_Repeat_Mode mode);
111EOAPI Efl_Animation_Object_Repeat_Mode efl_animation_object_repeat_mode_get(const Eo *obj);
112
104EOAPI void efl_animation_object_repeat_count_set(Eo *obj, int count); 113EOAPI void efl_animation_object_repeat_count_set(Eo *obj, int count);
105EOAPI int efl_animation_object_repeat_count_get(const Eo *obj); 114EOAPI int efl_animation_object_repeat_count_get(const Eo *obj);
106 115
diff --git a/src/lib/evas/canvas/efl_animation.c b/src/lib/evas/canvas/efl_animation.c
index 583cbf86a3..f01a40ba67 100644
--- a/src/lib/evas/canvas/efl_animation.c
+++ b/src/lib/evas/canvas/efl_animation.c
@@ -134,6 +134,27 @@ _efl_animation_object_create(Eo *eo_obj, Efl_Animation_Data *pd EINA_UNUSED)
134} 134}
135 135
136EOLIAN static void 136EOLIAN static void
137_efl_animation_repeat_mode_set(Eo *eo_obj,
138 Efl_Animation_Data *pd,
139 Efl_Animation_Repeat_Mode mode)
140{
141 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
142
143 if ((mode == EFL_ANIMATION_REPEAT_MODE_RESTART) ||
144 (mode == EFL_ANIMATION_REPEAT_MODE_REVERSE))
145 pd->repeat_mode = mode;
146}
147
148EOLIAN static Efl_Animation_Repeat_Mode
149_efl_animation_repeat_mode_get(Eo *eo_obj, Efl_Animation_Data *pd)
150{
151 EFL_ANIMATION_CHECK_OR_RETURN(eo_obj,
152 EFL_ANIMATION_REPEAT_MODE_RESTART);
153
154 return pd->repeat_mode;
155}
156
157EOLIAN static void
137_efl_animation_repeat_count_set(Eo *eo_obj, 158_efl_animation_repeat_count_set(Eo *eo_obj,
138 Efl_Animation_Data *pd, 159 Efl_Animation_Data *pd,
139 int count) 160 int count)
diff --git a/src/lib/evas/canvas/efl_animation.eo b/src/lib/evas/canvas/efl_animation.eo
index 7178cb6373..edcfec0d67 100644
--- a/src/lib/evas/canvas/efl_animation.eo
+++ b/src/lib/evas/canvas/efl_animation.eo
@@ -47,6 +47,15 @@ class Efl.Animation (Efl.Object)
47 total_duration: double; [[Total duration value.]] 47 total_duration: double; [[Total duration value.]]
48 } 48 }
49 } 49 }
50 @property repeat_mode {
51 set {
52 }
53 get {
54 }
55 values {
56 mode: Efl.Animation.Repeat_Mode; [[Repeat mode. EFL_ANIMATION_REPEAT_MODE_RESTART restarts animation when the animation ends and EFL_ANIMATION_REPEAT_MODE_REVERSE reverses animation when the animation ends.]]
57 }
58 }
50 @property repeat_count { 59 @property repeat_count {
51 set { 60 set {
52 } 61 }
diff --git a/src/lib/evas/canvas/efl_animation_alpha.c b/src/lib/evas/canvas/efl_animation_alpha.c
index f04c410334..8dff1442ed 100644
--- a/src/lib/evas/canvas/efl_animation_alpha.c
+++ b/src/lib/evas/canvas/efl_animation_alpha.c
@@ -50,6 +50,10 @@ _efl_animation_alpha_efl_animation_object_create(Eo *eo_obj,
50 double start_delay_time = efl_animation_start_delay_get(eo_obj); 50 double start_delay_time = efl_animation_start_delay_get(eo_obj);
51 efl_animation_object_start_delay_set(anim_obj, start_delay_time); 51 efl_animation_object_start_delay_set(anim_obj, start_delay_time);
52 52
53 Efl_Animation_Object_Repeat_Mode repeat_mode =
54 (Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
55 efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
56
53 int repeat_count = efl_animation_repeat_count_get(eo_obj); 57 int repeat_count = efl_animation_repeat_count_get(eo_obj);
54 efl_animation_object_repeat_count_set(anim_obj, repeat_count); 58 efl_animation_object_repeat_count_set(anim_obj, repeat_count);
55 59
diff --git a/src/lib/evas/canvas/efl_animation_group_parallel.c b/src/lib/evas/canvas/efl_animation_group_parallel.c
index 869d4ccbbe..36a2e0653b 100644
--- a/src/lib/evas/canvas/efl_animation_group_parallel.c
+++ b/src/lib/evas/canvas/efl_animation_group_parallel.c
@@ -109,6 +109,10 @@ _efl_animation_group_parallel_efl_animation_object_create(Eo *eo_obj,
109 double start_delay_time = efl_animation_start_delay_get(eo_obj); 109 double start_delay_time = efl_animation_start_delay_get(eo_obj);
110 efl_animation_object_start_delay_set(group_anim_obj, start_delay_time); 110 efl_animation_object_start_delay_set(group_anim_obj, start_delay_time);
111 111
112 Efl_Animation_Object_Repeat_Mode repeat_mode =
113 (Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
114 efl_animation_object_repeat_mode_set(group_anim_obj, repeat_mode);
115
112 int repeat_count = efl_animation_repeat_count_get(eo_obj); 116 int repeat_count = efl_animation_repeat_count_get(eo_obj);
113 efl_animation_object_repeat_count_set(group_anim_obj, repeat_count); 117 efl_animation_object_repeat_count_set(group_anim_obj, repeat_count);
114 118
diff --git a/src/lib/evas/canvas/efl_animation_group_sequential.c b/src/lib/evas/canvas/efl_animation_group_sequential.c
index e5a6c53e26..f40b769fdd 100644
--- a/src/lib/evas/canvas/efl_animation_group_sequential.c
+++ b/src/lib/evas/canvas/efl_animation_group_sequential.c
@@ -103,6 +103,10 @@ _efl_animation_group_sequential_efl_animation_object_create(Eo *eo_obj,
103 double start_delay_time = efl_animation_start_delay_get(eo_obj); 103 double start_delay_time = efl_animation_start_delay_get(eo_obj);
104 efl_animation_object_start_delay_set(group_anim_obj, start_delay_time); 104 efl_animation_object_start_delay_set(group_anim_obj, start_delay_time);
105 105
106 Efl_Animation_Object_Repeat_Mode repeat_mode =
107 (Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
108 efl_animation_object_repeat_mode_set(group_anim_obj, repeat_mode);
109
106 int repeat_count = efl_animation_repeat_count_get(eo_obj); 110 int repeat_count = efl_animation_repeat_count_get(eo_obj);
107 efl_animation_object_repeat_count_set(group_anim_obj, repeat_count); 111 efl_animation_object_repeat_count_set(group_anim_obj, repeat_count);
108 112
diff --git a/src/lib/evas/canvas/efl_animation_object.c b/src/lib/evas/canvas/efl_animation_object.c
index 17a1508135..b9c88f350b 100644
--- a/src/lib/evas/canvas/efl_animation_object.c
+++ b/src/lib/evas/canvas/efl_animation_object.c
@@ -106,6 +106,28 @@ _efl_animation_object_total_duration_get(Eo *eo_obj, Efl_Animation_Object_Data *
106} 106}
107 107
108EOLIAN static void 108EOLIAN static void
109_efl_animation_object_repeat_mode_set(Eo *eo_obj,
110 Efl_Animation_Object_Data *pd,
111 Efl_Animation_Object_Repeat_Mode mode)
112{
113 EFL_ANIMATION_OBJECT_CHECK_OR_RETURN(eo_obj);
114
115 if ((mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_RESTART) ||
116 (mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE))
117 pd->repeat_mode = mode;
118}
119
120EOLIAN static Efl_Animation_Object_Repeat_Mode
121_efl_animation_object_repeat_mode_get(const Eo *eo_obj,
122 Efl_Animation_Object_Data *pd)
123{
124 EFL_ANIMATION_OBJECT_CHECK_OR_RETURN((Eo *)eo_obj,
125 EFL_ANIMATION_OBJECT_REPEAT_MODE_RESTART);
126
127 return pd->repeat_mode;
128}
129
130EOLIAN static void
109_efl_animation_object_repeat_count_set(Eo *eo_obj, 131_efl_animation_object_repeat_count_set(Eo *eo_obj,
110 Efl_Animation_Object_Data *pd, 132 Efl_Animation_Object_Data *pd,
111 int count) 133 int count)
@@ -295,6 +317,16 @@ _animator_cb(void *data)
295 else 317 else
296 pd->progress = (elapsed_time - paused_time) / total_duration; 318 pd->progress = (elapsed_time - paused_time) / total_duration;
297 319
320 if (!pd->is_direction_forward)
321 pd->progress = 1.0 - pd->progress;
322
323 //If the direction is changed, then reset the target state.
324 if (pd->is_direction_changed)
325 {
326 pd->is_direction_changed = EINA_FALSE;
327 efl_animation_object_target_state_reset(eo_obj);
328 }
329
298 //Reset previous animation effect before applying animation effect 330 //Reset previous animation effect before applying animation effect
299 /* FIXME: When the target state is saved, it may not be finished to calculate 331 /* FIXME: When the target state is saved, it may not be finished to calculate
300 * target geometry. 332 * target geometry.
@@ -321,7 +353,11 @@ end:
321 pd->time.begin = ecore_loop_time_get(); 353 pd->time.begin = ecore_loop_time_get();
322 pd->paused_time = 0.0; 354 pd->paused_time = 0.0;
323 355
324 efl_animation_object_target_state_reset(eo_obj); 356 if (pd->repeat_mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE)
357 {
358 pd->is_direction_forward = !pd->is_direction_forward;
359 pd->is_direction_changed = EINA_TRUE;
360 }
325 361
326 return ECORE_CALLBACK_RENEW; 362 return ECORE_CALLBACK_RENEW;
327 } 363 }
@@ -351,6 +387,8 @@ _start(Eo *eo_obj, Efl_Animation_Object_Data *pd)
351 pd->is_started = EINA_TRUE; 387 pd->is_started = EINA_TRUE;
352 pd->is_cancelled = EINA_FALSE; 388 pd->is_cancelled = EINA_FALSE;
353 pd->is_ended = EINA_FALSE; 389 pd->is_ended = EINA_FALSE;
390 pd->is_direction_forward = EINA_TRUE;
391 pd->is_direction_changed = EINA_FALSE;
354 392
355 pd->paused_time = 0.0; 393 pd->paused_time = 0.0;
356 394
@@ -438,6 +476,9 @@ _efl_animation_object_progress_set(Eo *eo_obj,
438 476
439 if ((progress < 0.0) || (progress > 1.0)) return; 477 if ((progress < 0.0) || (progress > 1.0)) return;
440 478
479 if (!pd->is_direction_forward)
480 pd->progress = 1.0 - pd->progress;
481
441 Efl_Animation_Object_Running_Event_Info event_info; 482 Efl_Animation_Object_Running_Event_Info event_info;
442 event_info.progress = progress; 483 event_info.progress = progress;
443 484
@@ -503,6 +544,7 @@ _efl_animation_object_efl_object_constructor(Eo *eo_obj,
503 pd->duration = 0.0; 544 pd->duration = 0.0;
504 pd->total_duration = 0.0; 545 pd->total_duration = 0.0;
505 546
547 pd->repeat_mode = EFL_ANIMATION_OBJECT_REPEAT_MODE_RESTART;
506 pd->repeat_count = 0; 548 pd->repeat_count = 0;
507 549
508 pd->auto_del = EINA_TRUE; 550 pd->auto_del = EINA_TRUE;
@@ -559,6 +601,9 @@ EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_total_duration_get, double, 0);
559EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_start_delay_set, EFL_FUNC_CALL(delay_time), double delay_time); 601EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_start_delay_set, EFL_FUNC_CALL(delay_time), double delay_time);
560EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_start_delay_get, double, 0); 602EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_start_delay_get, double, 0);
561 603
604EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_repeat_mode_set, EFL_FUNC_CALL(mode), Efl_Animation_Object_Repeat_Mode mode);
605EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_mode_get, Efl_Animation_Object_Repeat_Mode, 0);
606
562EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_repeat_count_set, EFL_FUNC_CALL(count), int count); 607EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_repeat_count_set, EFL_FUNC_CALL(count), int count);
563EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_count_get, int, 0); 608EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_count_get, int, 0);
564 609
@@ -574,6 +619,8 @@ EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_count_get, int, 0);
574 EFL_OBJECT_OP_FUNC(efl_animation_object_total_duration_get, _efl_animation_object_total_duration_get), \ 619 EFL_OBJECT_OP_FUNC(efl_animation_object_total_duration_get, _efl_animation_object_total_duration_get), \
575 EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_set, _efl_animation_object_start_delay_set), \ 620 EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_set, _efl_animation_object_start_delay_set), \
576 EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_get, _efl_animation_object_start_delay_get), \ 621 EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_get, _efl_animation_object_start_delay_get), \
622 EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_mode_set, _efl_animation_object_repeat_mode_set), \
623 EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_mode_get, _efl_animation_object_repeat_mode_get), \
577 EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_set, _efl_animation_object_repeat_count_set), \ 624 EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_set, _efl_animation_object_repeat_count_set), \
578 EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_get, _efl_animation_object_repeat_count_get) 625 EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_get, _efl_animation_object_repeat_count_get)
579 626
diff --git a/src/lib/evas/canvas/efl_animation_object_group_parallel.c b/src/lib/evas/canvas/efl_animation_object_group_parallel.c
index 6d58e39247..2d551bf166 100644
--- a/src/lib/evas/canvas/efl_animation_object_group_parallel.c
+++ b/src/lib/evas/canvas/efl_animation_object_group_parallel.c
@@ -184,6 +184,8 @@ _efl_animation_object_group_parallel_efl_animation_object_progress_set(Eo *eo_ob
184 double start_delay = efl_animation_object_start_delay_get(anim_obj); 184 double start_delay = efl_animation_object_start_delay_get(anim_obj);
185 double anim_obj_progress; 185 double anim_obj_progress;
186 186
187 Eina_Bool start_repeat = EINA_FALSE;
188
187 if (total_duration == 0.0) 189 if (total_duration == 0.0)
188 anim_obj_progress = 1.0; 190 anim_obj_progress = 1.0;
189 else 191 else
@@ -220,11 +222,28 @@ _efl_animation_object_group_parallel_efl_animation_object_progress_set(Eo *eo_ob
220 { 222 {
221 repeated_count++; 223 repeated_count++;
222 _repeated_count_set(pd, anim_obj, repeated_count); 224 _repeated_count_set(pd, anim_obj, repeated_count);
225
226 start_repeat = EINA_TRUE;
223 } 227 }
224 } 228 }
225 } 229 }
226 } 230 }
227 231
232 /* If object is repeated with reverse mode, then the progress value
233 * should be modified as (1.0 - progress). */
234 Efl_Animation_Object_Repeat_Mode repeat_mode
235 = efl_animation_object_repeat_mode_get(anim_obj);
236 if (repeat_mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE)
237 {
238 int repeated_count = _repeated_count_get(pd, anim_obj);
239 if (repeated_count > 0)
240 {
241 if ((((repeated_count % 2) == 1) && (!start_repeat)) ||
242 (((repeated_count % 2) == 0) && (start_repeat)))
243 anim_obj_progress = 1.0 - anim_obj_progress;
244 }
245 }
246
228 efl_animation_object_progress_set(anim_obj, anim_obj_progress); 247 efl_animation_object_progress_set(anim_obj, anim_obj_progress);
229 } 248 }
230 249
diff --git a/src/lib/evas/canvas/efl_animation_object_group_sequential.c b/src/lib/evas/canvas/efl_animation_object_group_sequential.c
index 3b288248ef..c83bb8852c 100644
--- a/src/lib/evas/canvas/efl_animation_object_group_sequential.c
+++ b/src/lib/evas/canvas/efl_animation_object_group_sequential.c
@@ -190,6 +190,8 @@ _efl_animation_object_group_sequential_efl_animation_object_progress_set(Eo *eo_
190 double start_delay = efl_animation_object_start_delay_get(anim_obj); 190 double start_delay = efl_animation_object_start_delay_get(anim_obj);
191 double anim_obj_progress; 191 double anim_obj_progress;
192 192
193 Eina_Bool start_repeat = EINA_FALSE;
194
193 if (total_duration == 0.0) 195 if (total_duration == 0.0)
194 anim_obj_progress = 1.0; 196 anim_obj_progress = 1.0;
195 else 197 else
@@ -225,6 +227,8 @@ _efl_animation_object_group_sequential_efl_animation_object_progress_set(Eo *eo_
225 { 227 {
226 repeated_count++; 228 repeated_count++;
227 _repeated_count_set(pd, anim_obj, repeated_count); 229 _repeated_count_set(pd, anim_obj, repeated_count);
230
231 start_repeat = EINA_TRUE;
228 } 232 }
229 } 233 }
230 } 234 }
@@ -234,10 +238,25 @@ _efl_animation_object_group_sequential_efl_animation_object_progress_set(Eo *eo_
234 * delays */ 238 * delays */
235 sum_prev_total_duration += (total_duration + start_delay); 239 sum_prev_total_duration += (total_duration + start_delay);
236 240
237 if ((anim_obj_progress == 1.0) && 241 if ((anim_obj_progress == 1.0) && (!start_repeat) &&
238 !efl_animation_object_final_state_keep_get(anim_obj)) 242 (!efl_animation_object_final_state_keep_get(anim_obj)))
239 continue; 243 continue;
240 244
245 /* If object is repeated with reverse mode, then the progress value
246 * should be modified as (1.0 - progress). */
247 Efl_Animation_Object_Repeat_Mode repeat_mode
248 = efl_animation_object_repeat_mode_get(anim_obj);
249 if (repeat_mode == EFL_ANIMATION_OBJECT_REPEAT_MODE_REVERSE)
250 {
251 int repeated_count = _repeated_count_get(pd, anim_obj);
252 if (repeated_count > 0)
253 {
254 if ((((repeated_count % 2) == 1) && (!start_repeat)) ||
255 (((repeated_count % 2) == 0) && (start_repeat)))
256 anim_obj_progress = 1.0 - anim_obj_progress;
257 }
258 }
259
241 efl_animation_object_progress_set(anim_obj, anim_obj_progress); 260 efl_animation_object_progress_set(anim_obj, anim_obj_progress);
242 } 261 }
243 262
diff --git a/src/lib/evas/canvas/efl_animation_object_private.h b/src/lib/evas/canvas/efl_animation_object_private.h
index e27990a309..9df8b4edca 100644
--- a/src/lib/evas/canvas/efl_animation_object_private.h
+++ b/src/lib/evas/canvas/efl_animation_object_private.h
@@ -17,10 +17,10 @@ typedef struct _Target_State
17 17
18typedef struct _Efl_Animation_Object_Data 18typedef struct _Efl_Animation_Object_Data
19{ 19{
20 Ecore_Animator *animator; 20 Ecore_Animator *animator;
21 21
22 Ecore_Timer *start_delay_timer; 22 Ecore_Timer *start_delay_timer;
23 double start_delay_time; 23 double start_delay_time;
24 24
25 struct { 25 struct {
26 double begin; 26 double begin;
@@ -28,25 +28,28 @@ typedef struct _Efl_Animation_Object_Data
28 double pause_begin; 28 double pause_begin;
29 } time; 29 } time;
30 30
31 Efl_Canvas_Object *target; 31 Efl_Canvas_Object *target;
32 Target_State *target_state; 32 Target_State *target_state;
33 33
34 double progress; 34 double progress;
35 35
36 double duration; 36 double duration;
37 double total_duration; 37 double total_duration;
38 double paused_time; 38 double paused_time;
39 39
40 int repeat_count; 40 Efl_Animation_Object_Repeat_Mode repeat_mode;
41 int remaining_repeat_count; 41 int repeat_count;
42 int remaining_repeat_count;
42 43
43 Eina_Bool auto_del : 1; 44 Eina_Bool auto_del : 1;
44 Eina_Bool is_deleted : 1; 45 Eina_Bool is_deleted : 1;
45 Eina_Bool is_started : 1; 46 Eina_Bool is_started : 1;
46 Eina_Bool is_cancelled : 1; 47 Eina_Bool is_cancelled : 1;
47 Eina_Bool is_ended : 1; 48 Eina_Bool is_ended : 1;
48 Eina_Bool is_paused : 1; 49 Eina_Bool is_paused : 1;
49 Eina_Bool keep_final_state : 1; 50 Eina_Bool keep_final_state : 1;
51 Eina_Bool is_direction_forward : 1;
52 Eina_Bool is_direction_changed : 1;
50} Efl_Animation_Object_Data; 53} Efl_Animation_Object_Data;
51 54
52#define EFL_ANIMATION_OBJECT_CHECK_OR_RETURN(anim_obj, ...) \ 55#define EFL_ANIMATION_OBJECT_CHECK_OR_RETURN(anim_obj, ...) \
diff --git a/src/lib/evas/canvas/efl_animation_private.h b/src/lib/evas/canvas/efl_animation_private.h
index 6c993f4bd3..1cd84d2a59 100644
--- a/src/lib/evas/canvas/efl_animation_private.h
+++ b/src/lib/evas/canvas/efl_animation_private.h
@@ -7,17 +7,18 @@
7 7
8typedef struct _Efl_Animation_Data 8typedef struct _Efl_Animation_Data
9{ 9{
10 Efl_Canvas_Object *target; 10 Efl_Canvas_Object *target;
11 11
12 double duration; 12 double duration;
13 double total_duration; 13 double total_duration;
14 14
15 double start_delay_time; 15 double start_delay_time;
16 16
17 int repeat_count; 17 Efl_Animation_Repeat_Mode repeat_mode;
18 int repeat_count;
18 19
19 Eina_Bool is_deleted : 1; 20 Eina_Bool is_deleted : 1;
20 Eina_Bool keep_final_state : 1; 21 Eina_Bool keep_final_state : 1;
21} Efl_Animation_Data; 22} Efl_Animation_Data;
22 23
23#define EFL_ANIMATION_CHECK_OR_RETURN(anim, ...) \ 24#define EFL_ANIMATION_CHECK_OR_RETURN(anim, ...) \
diff --git a/src/lib/evas/canvas/efl_animation_rotate.c b/src/lib/evas/canvas/efl_animation_rotate.c
index 7e3851769b..addfc2e9bf 100644
--- a/src/lib/evas/canvas/efl_animation_rotate.c
+++ b/src/lib/evas/canvas/efl_animation_rotate.c
@@ -198,6 +198,10 @@ _efl_animation_rotate_efl_animation_object_create(Eo *eo_obj,
198 double start_delay_time = efl_animation_start_delay_get(eo_obj); 198 double start_delay_time = efl_animation_start_delay_get(eo_obj);
199 efl_animation_object_start_delay_set(anim_obj, start_delay_time); 199 efl_animation_object_start_delay_set(anim_obj, start_delay_time);
200 200
201 Efl_Animation_Object_Repeat_Mode repeat_mode =
202 (Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
203 efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
204
201 int repeat_count = efl_animation_repeat_count_get(eo_obj); 205 int repeat_count = efl_animation_repeat_count_get(eo_obj);
202 efl_animation_object_repeat_count_set(anim_obj, repeat_count); 206 efl_animation_object_repeat_count_set(anim_obj, repeat_count);
203 207
diff --git a/src/lib/evas/canvas/efl_animation_scale.c b/src/lib/evas/canvas/efl_animation_scale.c
index 2c3ba7c445..ed7ad3b142 100644
--- a/src/lib/evas/canvas/efl_animation_scale.c
+++ b/src/lib/evas/canvas/efl_animation_scale.c
@@ -224,6 +224,10 @@ _efl_animation_scale_efl_animation_object_create(Eo *eo_obj,
224 double start_delay_time = efl_animation_start_delay_get(eo_obj); 224 double start_delay_time = efl_animation_start_delay_get(eo_obj);
225 efl_animation_object_start_delay_set(anim_obj, start_delay_time); 225 efl_animation_object_start_delay_set(anim_obj, start_delay_time);
226 226
227 Efl_Animation_Object_Repeat_Mode repeat_mode =
228 (Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
229 efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
230
227 int repeat_count = efl_animation_repeat_count_get(eo_obj); 231 int repeat_count = efl_animation_repeat_count_get(eo_obj);
228 efl_animation_object_repeat_count_set(anim_obj, repeat_count); 232 efl_animation_object_repeat_count_set(anim_obj, repeat_count);
229 233
diff --git a/src/lib/evas/canvas/efl_animation_translate.c b/src/lib/evas/canvas/efl_animation_translate.c
index 2ffc158452..622727697f 100644
--- a/src/lib/evas/canvas/efl_animation_translate.c
+++ b/src/lib/evas/canvas/efl_animation_translate.c
@@ -166,6 +166,10 @@ _efl_animation_translate_efl_animation_object_create(Eo *eo_obj,
166 double start_delay_time = efl_animation_start_delay_get(eo_obj); 166 double start_delay_time = efl_animation_start_delay_get(eo_obj);
167 efl_animation_object_start_delay_set(anim_obj, start_delay_time); 167 efl_animation_object_start_delay_set(anim_obj, start_delay_time);
168 168
169 Efl_Animation_Object_Repeat_Mode repeat_mode =
170 (Efl_Animation_Object_Repeat_Mode)efl_animation_repeat_mode_get(eo_obj);
171 efl_animation_object_repeat_mode_set(anim_obj, repeat_mode);
172
169 int repeat_count = efl_animation_repeat_count_get(eo_obj); 173 int repeat_count = efl_animation_repeat_count_get(eo_obj);
170 efl_animation_object_repeat_count_set(anim_obj, repeat_count); 174 efl_animation_object_repeat_count_set(anim_obj, repeat_count);
171 175
diff --git a/src/lib/evas/canvas/efl_animation_types.eot b/src/lib/evas/canvas/efl_animation_types.eot
index a3f4ca47b9..099efbfd94 100644
--- a/src/lib/evas/canvas/efl_animation_types.eot
+++ b/src/lib/evas/canvas/efl_animation_types.eot
@@ -11,3 +11,11 @@ enum Efl.Animation.Event_Type
11 hide = 1, [["hide" event type]] 11 hide = 1, [["hide" event type]]
12 clicked = 2 [["clicked" event type]] 12 clicked = 2 [["clicked" event type]]
13} 13}
14
15enum Efl.Animation.Repeat_Mode
16{
17 [[Animation repeat mode]]
18
19 restart = 0, [[Restart animation when the animation ends.]]
20 reverse [[Reverse animation when the animation ends.]]
21}