summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2017-09-04 19:17:48 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2017-10-12 21:03:49 +0900
commit595f47e202c1946d27bb0c39868a9bf8f4b98d78 (patch)
treeb52cebe5afbe6a9ffb21bd2294226beb1b5c2f3f
parent108994d383f943f968d7fdead79220c496ebc811 (diff)
downloadefl-595f47e202c1946d27bb0c39868a9bf8f4b98d78.tar.gz
efl_animation: Add start_delay property
Add start_delay property to delay the given amount of time in seconds from when the animation starts until the animation is animated.
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/bin/elementary/Makefile.am1
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_efl_anim_start_delay.c160
-rw-r--r--src/lib/evas/Evas_Internal.h3
-rw-r--r--src/lib/evas/canvas/efl_animation.c23
-rw-r--r--src/lib/evas/canvas/efl_animation.eo9
-rw-r--r--src/lib/evas/canvas/efl_animation_alpha.c3
-rw-r--r--src/lib/evas/canvas/efl_animation_group_parallel.c7
-rw-r--r--src/lib/evas/canvas/efl_animation_group_sequential.c7
-rw-r--r--src/lib/evas/canvas/efl_animation_object.c57
-rw-r--r--src/lib/evas/canvas/efl_animation_object_group_parallel.c17
-rw-r--r--src/lib/evas/canvas/efl_animation_object_group_sequential.c23
-rw-r--r--src/lib/evas/canvas/efl_animation_object_private.h3
-rw-r--r--src/lib/evas/canvas/efl_animation_private.h2
-rw-r--r--src/lib/evas/canvas/efl_animation_rotate.c3
-rw-r--r--src/lib/evas/canvas/efl_animation_scale.c3
-rw-r--r--src/lib/evas/canvas/efl_animation_translate.c3
18 files changed, 319 insertions, 8 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 8d45eb3312..bcf39cce8e 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -806,6 +806,7 @@ bin/elementary/test_efl_anim_group_sequential.c \
bin/elementary/test_efl_anim_event_anim.c \
bin/elementary/test_efl_anim_pause.c \
bin/elementary/test_efl_anim_repeat.c \
+bin/elementary/test_efl_anim_start_delay.c \
bin/elementary/test_eio.c \
bin/elementary/test_entry.c \
bin/elementary/test_entry_anchor.c \
diff --git a/src/bin/elementary/Makefile.am b/src/bin/elementary/Makefile.am
index a9fb32668f..ce87962c3c 100644
--- a/src/bin/elementary/Makefile.am
+++ b/src/bin/elementary/Makefile.am
@@ -41,6 +41,7 @@ test_efl_anim_group_sequential.c \
test_efl_anim_event_anim.c \
test_efl_anim_pause.c \
test_efl_anim_repeat.c \
+test_efl_anim_start_delay.c \
test_application_server.c \
test_bg.c \
test_box.c \
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index e86b78df8b..095eee5186 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -336,6 +336,7 @@ void test_efl_anim_group_sequential(void *data, Evas_Object *obj, void *event_in
void test_efl_anim_event_anim(void *data, Evas_Object *obj, void *event_info);
void test_efl_anim_pause(void *data, Evas_Object *obj, void *event_info);
void test_efl_anim_repeat(void *data, Evas_Object *obj, void *event_info);
+void test_efl_anim_start_delay(void *data, Evas_Object *obj, void *event_info);
Evas_Object *win, *tbx; // TODO: refactoring
void *tt;
@@ -819,6 +820,7 @@ add_tests:
ADD_TEST(NULL, "Effects", "Efl Animation Event Animation", test_efl_anim_event_anim);
ADD_TEST(NULL, "Effects", "Efl Animation Pause", test_efl_anim_pause);
ADD_TEST(NULL, "Effects", "Efl Animation Repeat", test_efl_anim_repeat);
+ ADD_TEST(NULL, "Effects", "Efl Animation Start Delay", test_efl_anim_start_delay);
//------------------------------//
ADD_TEST(NULL, "Edje External", "ExtButton", test_external_button);
diff --git a/src/bin/elementary/test_efl_anim_start_delay.c b/src/bin/elementary/test_efl_anim_start_delay.c
new file mode 100644
index 0000000000..63cab0f18e
--- /dev/null
+++ b/src/bin/elementary/test_efl_anim_start_delay.c
@@ -0,0 +1,160 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+#include <Elementary.h>
+
+typedef struct _App_Data
+{
+ Efl_Animation *show_anim;
+ Efl_Animation *hide_anim;
+ Efl_Animation_Object *anim_obj;
+
+ Evas_Object *start_delay_spin;
+
+ Eina_Bool is_btn_visible;
+} App_Data;
+
+static void
+_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
+{
+ printf("Animation has been started!\n");
+}
+
+static void
+_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
+{
+ App_Data *ad = data;
+
+ printf("Animation has been ended!\n");
+
+ elm_object_disabled_set(ad->start_delay_spin, EINA_FALSE);
+
+ ad->anim_obj = NULL;
+}
+
+static void
+_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
+{
+ Efl_Animation_Object_Running_Event_Info *event_info = event->info;
+ double progress = event_info->progress;
+ printf("Animation is running! Current progress(%lf)\n", progress);
+}
+
+static void
+_start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
+{
+ App_Data *ad = data;
+
+ if (ad->anim_obj)
+ efl_animation_object_cancel(ad->anim_obj);
+
+ ad->is_btn_visible = !(ad->is_btn_visible);
+
+ double start_delay = elm_spinner_value_get(ad->start_delay_spin);
+ elm_object_disabled_set(ad->start_delay_spin, EINA_TRUE);
+
+ if (ad->is_btn_visible)
+ {
+ //Set animation start delay
+ efl_animation_start_delay_set(ad->show_anim, start_delay);
+
+ //Create Animation Object from Animation
+ ad->anim_obj = efl_animation_object_create(ad->show_anim);
+ elm_object_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
+ }
+ else
+ {
+ //Set animation start delay
+ efl_animation_start_delay_set(ad->hide_anim, start_delay);
+
+ //Create Animation Object from Animation
+ ad->anim_obj = efl_animation_object_create(ad->hide_anim);
+ elm_object_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
+ }
+
+ //Register callback called when animation starts
+ efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_STARTED, _anim_started_cb, NULL);
+
+ //Register callback called when animation ends
+ efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_ENDED, _anim_ended_cb, ad);
+
+ //Register callback called while animation is executed
+ efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_OBJECT_EVENT_RUNNING, _anim_running_cb, NULL);
+
+ //Let Animation Object start animation
+ efl_animation_object_start(ad->anim_obj);
+}
+
+static void
+_win_del_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ App_Data *ad = data;
+ free(ad);
+}
+
+void
+test_efl_anim_start_delay(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
+{
+ App_Data *ad = calloc(1, sizeof(App_Data));
+ if (!ad) return;
+
+ Evas_Object *win = elm_win_add(NULL, "Efl Animation Start Delay", ELM_WIN_BASIC);
+ elm_win_title_set(win, "Efl Animation Start Delay");
+ elm_win_autodel_set(win, EINA_TRUE);
+ evas_object_smart_callback_add(win, "delete,request", _win_del_cb, ad);
+
+ //Button to be animated
+ Evas_Object *btn = elm_button_add(win);
+ elm_object_text_set(btn, "Button");
+ evas_object_size_hint_weight_set(btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_resize(btn, 200, 200);
+ evas_object_move(btn, 100, 50);
+ evas_object_show(btn);
+
+ //Show Animation
+ Efl_Animation *show_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
+ efl_animation_alpha_set(show_anim, 0.0, 1.0);
+ efl_animation_duration_set(show_anim, 1.0);
+ efl_animation_target_set(show_anim, btn);
+ efl_animation_final_state_keep_set(show_anim, EINA_TRUE);
+
+ //Hide Animation
+ Efl_Animation *hide_anim = efl_add(EFL_ANIMATION_ALPHA_CLASS, NULL);
+ efl_animation_alpha_set(hide_anim, 1.0, 0.0);
+ efl_animation_duration_set(hide_anim, 1.0);
+ efl_animation_target_set(hide_anim, btn);
+ efl_animation_final_state_keep_set(hide_anim, EINA_TRUE);
+
+
+ //Button to start animation
+ Evas_Object *start_btn = elm_button_add(win);
+ elm_object_text_set(start_btn, "Start Alpha Animation from 1.0 to 0.0");
+ evas_object_smart_callback_add(start_btn, "clicked", _start_btn_clicked_cb, ad);
+ evas_object_size_hint_weight_set(start_btn, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+ evas_object_resize(start_btn, 200, 50);
+ evas_object_move(start_btn, 100, 300);
+ evas_object_show(start_btn);
+
+ //Spinner to set animation start delay
+ Evas_Object *start_delay_spin = elm_spinner_add(win);
+ elm_spinner_label_format_set(start_delay_spin, "Start Delay: %.1f second");
+ elm_spinner_editable_set(start_delay_spin, EINA_FALSE);
+ elm_spinner_min_max_set(start_delay_spin, 0.0, 10.0);
+ elm_spinner_step_set(start_delay_spin, 0.5);
+ elm_spinner_value_set(start_delay_spin, 0.0);
+ evas_object_resize(start_delay_spin, 200, 50);
+ evas_object_move(start_delay_spin, 100, 350);
+ evas_object_show(start_delay_spin);
+
+
+ //Initialize App Data
+ ad->show_anim = show_anim;
+ ad->hide_anim = hide_anim;
+ ad->anim_obj = NULL;
+ ad->start_delay_spin = start_delay_spin;
+ ad->is_btn_visible = EINA_TRUE;
+
+
+ evas_object_resize(win, 400, 450);
+ evas_object_show(win);
+}
diff --git a/src/lib/evas/Evas_Internal.h b/src/lib/evas/Evas_Internal.h
index 45057bd1a3..e57b60163c 100644
--- a/src/lib/evas/Evas_Internal.h
+++ b/src/lib/evas/Evas_Internal.h
@@ -98,6 +98,9 @@ EOAPI void efl_animation_object_duration_only_set(Eo *obj, double duration);
EOAPI void efl_animation_object_total_duration_set(Eo *obj, double total_duration);
EOAPI double efl_animation_object_total_duration_get(const Eo *obj);
+EOAPI void efl_animation_object_start_delay_set(Eo *obj, double delay_time);
+EOAPI double efl_animation_object_start_delay_get(const Eo *obj);
+
EOAPI void efl_animation_object_repeat_count_set(Eo *obj, int count);
EOAPI int efl_animation_object_repeat_count_get(const Eo *obj);
diff --git a/src/lib/evas/canvas/efl_animation.c b/src/lib/evas/canvas/efl_animation.c
index 3ab7434195..583cbf86a3 100644
--- a/src/lib/evas/canvas/efl_animation.c
+++ b/src/lib/evas/canvas/efl_animation.c
@@ -154,6 +154,27 @@ _efl_animation_repeat_count_get(Eo *eo_obj, Efl_Animation_Data *pd)
return pd->repeat_count;
}
+EOLIAN static void
+_efl_animation_start_delay_set(Eo *eo_obj,
+ Efl_Animation_Data *pd,
+ double delay_time)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj);
+
+ if (delay_time < 0.0) return;
+
+ pd->start_delay_time = delay_time;
+}
+
+EOLIAN static double
+_efl_animation_start_delay_get(Eo *eo_obj,
+ Efl_Animation_Data *pd)
+{
+ EFL_ANIMATION_CHECK_OR_RETURN(eo_obj, 0.0);
+
+ return pd->start_delay_time;
+}
+
EOLIAN static Efl_Object *
_efl_animation_efl_object_constructor(Eo *eo_obj,
Efl_Animation_Data *pd)
@@ -164,6 +185,8 @@ _efl_animation_efl_object_constructor(Eo *eo_obj,
pd->duration = 0.0;
+ pd->start_delay_time = 0.0;
+
pd->repeat_count = 0;
pd->is_deleted = EINA_FALSE;
diff --git a/src/lib/evas/canvas/efl_animation.eo b/src/lib/evas/canvas/efl_animation.eo
index d071100dee..7178cb6373 100644
--- a/src/lib/evas/canvas/efl_animation.eo
+++ b/src/lib/evas/canvas/efl_animation.eo
@@ -56,6 +56,15 @@ class Efl.Animation (Efl.Object)
count: int; [[Repeat count. EFL_ANIMATION_REPEAT_INFINITE repeats animation infinitely.]]
}
}
+ @property start_delay {
+ set {
+ }
+ get {
+ }
+ values {
+ delay_time: double; [[Delay time, in seconds, from when the animation starts until the animation is animated]]
+ }
+ }
is_deleted @protected {
return: bool; [[$true if animation is deleted, $false otherwise.]]
}
diff --git a/src/lib/evas/canvas/efl_animation_alpha.c b/src/lib/evas/canvas/efl_animation_alpha.c
index 763788d4bc..f04c410334 100644
--- a/src/lib/evas/canvas/efl_animation_alpha.c
+++ b/src/lib/evas/canvas/efl_animation_alpha.c
@@ -47,6 +47,9 @@ _efl_animation_alpha_efl_animation_object_create(Eo *eo_obj,
double total_duration = efl_animation_total_duration_get(eo_obj);
efl_animation_object_total_duration_set(anim_obj, total_duration);
+ double start_delay_time = efl_animation_start_delay_get(eo_obj);
+ efl_animation_object_start_delay_set(anim_obj, start_delay_time);
+
int repeat_count = efl_animation_repeat_count_get(eo_obj);
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
diff --git a/src/lib/evas/canvas/efl_animation_group_parallel.c b/src/lib/evas/canvas/efl_animation_group_parallel.c
index 9c02c8c907..869d4ccbbe 100644
--- a/src/lib/evas/canvas/efl_animation_group_parallel.c
+++ b/src/lib/evas/canvas/efl_animation_group_parallel.c
@@ -59,6 +59,10 @@ _efl_animation_group_parallel_efl_animation_total_duration_get(Eo *eo_obj,
{
double child_total_duration = efl_animation_total_duration_get(anim);
+ double start_delay = efl_animation_start_delay_get(anim);
+ if (start_delay > 0.0)
+ child_total_duration += start_delay;
+
int child_repeat_count = efl_animation_repeat_count_get(anim);
if (child_repeat_count > 0)
child_total_duration *= (child_repeat_count + 1);
@@ -102,6 +106,9 @@ _efl_animation_group_parallel_efl_animation_object_create(Eo *eo_obj,
double total_duration = efl_animation_total_duration_get(eo_obj);
efl_animation_object_total_duration_set(group_anim_obj, total_duration);
+ double start_delay_time = efl_animation_start_delay_get(eo_obj);
+ efl_animation_object_start_delay_set(group_anim_obj, start_delay_time);
+
int repeat_count = efl_animation_repeat_count_get(eo_obj);
efl_animation_object_repeat_count_set(group_anim_obj, repeat_count);
diff --git a/src/lib/evas/canvas/efl_animation_group_sequential.c b/src/lib/evas/canvas/efl_animation_group_sequential.c
index b29599bd25..e5a6c53e26 100644
--- a/src/lib/evas/canvas/efl_animation_group_sequential.c
+++ b/src/lib/evas/canvas/efl_animation_group_sequential.c
@@ -54,6 +54,10 @@ _efl_animation_group_sequential_efl_animation_total_duration_get(Eo *eo_obj,
{
double child_total_duration = efl_animation_total_duration_get(anim);
+ double start_delay = efl_animation_start_delay_get(anim);
+ if (start_delay > 0.0)
+ child_total_duration += start_delay;
+
int child_repeat_count = efl_animation_repeat_count_get(anim);
if (child_repeat_count > 0)
child_total_duration *= (child_repeat_count + 1);
@@ -96,6 +100,9 @@ _efl_animation_group_sequential_efl_animation_object_create(Eo *eo_obj,
double total_duration = efl_animation_total_duration_get(eo_obj);
efl_animation_object_total_duration_set(group_anim_obj, total_duration);
+ double start_delay_time = efl_animation_start_delay_get(eo_obj);
+ efl_animation_object_start_delay_set(group_anim_obj, start_delay_time);
+
int repeat_count = efl_animation_repeat_count_get(eo_obj);
efl_animation_object_repeat_count_set(group_anim_obj, repeat_count);
diff --git a/src/lib/evas/canvas/efl_animation_object.c b/src/lib/evas/canvas/efl_animation_object.c
index 619af19895..17a1508135 100644
--- a/src/lib/evas/canvas/efl_animation_object.c
+++ b/src/lib/evas/canvas/efl_animation_object.c
@@ -127,6 +127,28 @@ _efl_animation_object_repeat_count_get(const Eo *eo_obj,
return pd->repeat_count;
}
+EOLIAN static void
+_efl_animation_object_start_delay_set(Eo *eo_obj,
+ Efl_Animation_Object_Data *pd,
+ double delay_time)
+{
+ EFL_ANIMATION_OBJECT_CHECK_OR_RETURN(eo_obj);
+
+ if (delay_time < 0.0) return;
+
+ pd->start_delay_time = delay_time;
+}
+
+EOLIAN static double
+_efl_animation_object_start_delay_get(Eo *eo_obj,
+ Efl_Animation_Object_Data *pd)
+{
+ EFL_ANIMATION_OBJECT_CHECK_OR_RETURN(eo_obj, 0.0);
+
+ return pd->start_delay_time;
+}
+
+
EOLIAN static Eina_Bool
_efl_animation_object_is_deleted(Eo *eo_obj,
Efl_Animation_Object_Data *pd)
@@ -329,7 +351,6 @@ _start(Eo *eo_obj, Efl_Animation_Object_Data *pd)
pd->is_started = EINA_TRUE;
pd->is_cancelled = EINA_FALSE;
pd->is_ended = EINA_FALSE;
- pd->is_paused = EINA_FALSE;
pd->paused_time = 0.0;
@@ -350,12 +371,34 @@ _start(Eo *eo_obj, Efl_Animation_Object_Data *pd)
_animator_cb(eo_obj);
}
+static Eina_Bool
+_start_delay_timer_cb(void *data)
+{
+ Eo *eo_obj = data;
+ EFL_ANIMATION_OBJECT_DATA_GET(eo_obj, pd);
+
+ pd->start_delay_timer = NULL;
+
+ _start(eo_obj, pd);
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
EOLIAN static void
_efl_animation_object_start(Eo *eo_obj,
Efl_Animation_Object_Data *pd)
{
EFL_ANIMATION_OBJECT_CHECK_OR_RETURN(eo_obj);
+ if (pd->start_delay_timer) return;
+
+ if (pd->start_delay_time > 0.0)
+ {
+ pd->start_delay_timer = ecore_timer_add(pd->start_delay_time,
+ _start_delay_timer_cb, eo_obj);
+ return;
+ }
+
_start(eo_obj, pd);
}
@@ -365,6 +408,9 @@ _efl_animation_object_cancel(Eo *eo_obj,
{
EFL_ANIMATION_OBJECT_CHECK_OR_RETURN(eo_obj);
+ ecore_timer_del(pd->start_delay_timer);
+ pd->start_delay_timer = NULL;
+
pd->is_cancelled = EINA_TRUE;
pd->is_ended = EINA_TRUE;
@@ -411,6 +457,8 @@ _efl_animation_object_pause(Eo *eo_obj,
pd->is_paused = EINA_TRUE;
+ if (pd->start_delay_timer) return;
+
ecore_animator_del(pd->animator);
pd->animator = NULL;
@@ -429,6 +477,8 @@ _efl_animation_object_resume(Eo *eo_obj,
pd->is_paused = EINA_FALSE;
+ if (pd->start_delay_timer) return;
+
pd->paused_time += (ecore_loop_time_get() - pd->time.pause_begin);
pd->animator = ecore_animator_add(_animator_cb, eo_obj);
@@ -506,6 +556,9 @@ EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_duration_only_set, EFL_FUNC_CALL(
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_total_duration_set, EFL_FUNC_CALL(total_duration), double total_duration);
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_total_duration_get, double, 0);
+EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_start_delay_set, EFL_FUNC_CALL(delay_time), double delay_time);
+EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_start_delay_get, double, 0);
+
EOAPI EFL_VOID_FUNC_BODYV(efl_animation_object_repeat_count_set, EFL_FUNC_CALL(count), int count);
EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_count_get, int, 0);
@@ -519,6 +572,8 @@ EOAPI EFL_FUNC_BODY_CONST(efl_animation_object_repeat_count_get, int, 0);
EFL_OBJECT_OP_FUNC(efl_animation_object_duration_only_set, _efl_animation_object_duration_only_set), \
EFL_OBJECT_OP_FUNC(efl_animation_object_total_duration_set, _efl_animation_object_total_duration_set), \
EFL_OBJECT_OP_FUNC(efl_animation_object_total_duration_get, _efl_animation_object_total_duration_get), \
+ EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_set, _efl_animation_object_start_delay_set), \
+ EFL_OBJECT_OP_FUNC(efl_animation_object_start_delay_get, _efl_animation_object_start_delay_get), \
EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_set, _efl_animation_object_repeat_count_set), \
EFL_OBJECT_OP_FUNC(efl_animation_object_repeat_count_get, _efl_animation_object_repeat_count_get)
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 7e23b73877..6d58e39247 100644
--- a/src/lib/evas/canvas/efl_animation_object_group_parallel.c
+++ b/src/lib/evas/canvas/efl_animation_object_group_parallel.c
@@ -119,6 +119,10 @@ _efl_animation_object_group_parallel_efl_animation_object_total_duration_get(Eo
double child_total_duration =
efl_animation_object_total_duration_get(anim_obj);
+ double start_delay = efl_animation_object_start_delay_get(anim_obj);
+ if (start_delay > 0.0)
+ child_total_duration += start_delay;
+
int child_repeat_count =
efl_animation_object_repeat_count_get(anim_obj);
if (child_repeat_count > 0)
@@ -177,18 +181,27 @@ _efl_animation_object_group_parallel_efl_animation_object_progress_set(Eo *eo_ob
{
double total_duration =
efl_animation_object_total_duration_get(anim_obj);
+ double start_delay = efl_animation_object_start_delay_get(anim_obj);
double anim_obj_progress;
if (total_duration == 0.0)
anim_obj_progress = 1.0;
else
{
+ double elapsed_time_without_delay;
+
//If object is repeated, then recalculate progress.
int repeated_count = _repeated_count_get(pd, anim_obj);
if (repeated_count > 0)
- anim_obj_progress = (elapsed_time - (total_duration * repeated_count)) / total_duration;
+ elapsed_time_without_delay =
+ (elapsed_time - ((total_duration + start_delay) * repeated_count)) - start_delay;
else
- anim_obj_progress = elapsed_time / total_duration;
+ elapsed_time_without_delay = elapsed_time - start_delay;
+
+ //Object should not start to wait for start delay time.
+ if (elapsed_time_without_delay < 0.0) continue;
+
+ anim_obj_progress = elapsed_time_without_delay / total_duration;
if (anim_obj_progress > 1.0)
anim_obj_progress = 1.0;
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 9dcbd2a7ac..3b288248ef 100644
--- a/src/lib/evas/canvas/efl_animation_object_group_sequential.c
+++ b/src/lib/evas/canvas/efl_animation_object_group_sequential.c
@@ -121,6 +121,10 @@ _efl_animation_object_group_sequential_efl_animation_object_total_duration_get(E
double child_total_duration =
efl_animation_object_total_duration_get(anim_obj);
+ double start_delay = efl_animation_object_start_delay_get(anim_obj);
+ if (start_delay > 0.0)
+ child_total_duration += start_delay;
+
int child_repeat_count =
efl_animation_object_repeat_count_get(anim_obj);
if (child_repeat_count > 0)
@@ -183,6 +187,7 @@ _efl_animation_object_group_sequential_efl_animation_object_progress_set(Eo *eo_
//Sum the current total duration
double total_duration =
efl_animation_object_total_duration_get(anim_obj);
+ double start_delay = efl_animation_object_start_delay_get(anim_obj);
double anim_obj_progress;
if (total_duration == 0.0)
@@ -192,10 +197,17 @@ _efl_animation_object_group_sequential_efl_animation_object_progress_set(Eo *eo_
//If object is repeated, then recalculate progress.
int repeated_count = _repeated_count_get(pd, anim_obj);
if (repeated_count > 0)
- sum_prev_total_duration += (total_duration * repeated_count);
+ sum_prev_total_duration +=
+ ((total_duration + start_delay) * repeated_count);
+
+ double elapsed_time_without_delay =
+ elapsed_time - sum_prev_total_duration - start_delay;
+
+ //Object should not start to wait for start delay time.
+ if (elapsed_time_without_delay < 0.0) break;
+
+ anim_obj_progress = elapsed_time_without_delay / total_duration;
- anim_obj_progress =
- (elapsed_time - sum_prev_total_duration) / total_duration;
if (anim_obj_progress > 1.0)
anim_obj_progress = 1.0;
@@ -218,8 +230,9 @@ _efl_animation_object_group_sequential_efl_animation_object_progress_set(Eo *eo_
}
}
- //Update the sum of the previous objects' total durations
- sum_prev_total_duration += total_duration;
+ /* Update the sum of the previous objects' total durations and start
+ * delays */
+ sum_prev_total_duration += (total_duration + start_delay);
if ((anim_obj_progress == 1.0) &&
!efl_animation_object_final_state_keep_get(anim_obj))
diff --git a/src/lib/evas/canvas/efl_animation_object_private.h b/src/lib/evas/canvas/efl_animation_object_private.h
index f82d24fc40..e27990a309 100644
--- a/src/lib/evas/canvas/efl_animation_object_private.h
+++ b/src/lib/evas/canvas/efl_animation_object_private.h
@@ -19,6 +19,9 @@ typedef struct _Efl_Animation_Object_Data
{
Ecore_Animator *animator;
+ Ecore_Timer *start_delay_timer;
+ double start_delay_time;
+
struct {
double begin;
double current;
diff --git a/src/lib/evas/canvas/efl_animation_private.h b/src/lib/evas/canvas/efl_animation_private.h
index 49e635c22a..6c993f4bd3 100644
--- a/src/lib/evas/canvas/efl_animation_private.h
+++ b/src/lib/evas/canvas/efl_animation_private.h
@@ -12,6 +12,8 @@ typedef struct _Efl_Animation_Data
double duration;
double total_duration;
+ double start_delay_time;
+
int repeat_count;
Eina_Bool is_deleted : 1;
diff --git a/src/lib/evas/canvas/efl_animation_rotate.c b/src/lib/evas/canvas/efl_animation_rotate.c
index 362464c917..7e3851769b 100644
--- a/src/lib/evas/canvas/efl_animation_rotate.c
+++ b/src/lib/evas/canvas/efl_animation_rotate.c
@@ -195,6 +195,9 @@ _efl_animation_rotate_efl_animation_object_create(Eo *eo_obj,
double total_duration = efl_animation_total_duration_get(eo_obj);
efl_animation_object_total_duration_set(anim_obj, total_duration);
+ double start_delay_time = efl_animation_start_delay_get(eo_obj);
+ efl_animation_object_start_delay_set(anim_obj, start_delay_time);
+
int repeat_count = efl_animation_repeat_count_get(eo_obj);
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
diff --git a/src/lib/evas/canvas/efl_animation_scale.c b/src/lib/evas/canvas/efl_animation_scale.c
index dad906e987..2c3ba7c445 100644
--- a/src/lib/evas/canvas/efl_animation_scale.c
+++ b/src/lib/evas/canvas/efl_animation_scale.c
@@ -221,6 +221,9 @@ _efl_animation_scale_efl_animation_object_create(Eo *eo_obj,
double total_duration = efl_animation_total_duration_get(eo_obj);
efl_animation_object_total_duration_set(anim_obj, total_duration);
+ double start_delay_time = efl_animation_start_delay_get(eo_obj);
+ efl_animation_object_start_delay_set(anim_obj, start_delay_time);
+
int repeat_count = efl_animation_repeat_count_get(eo_obj);
efl_animation_object_repeat_count_set(anim_obj, repeat_count);
diff --git a/src/lib/evas/canvas/efl_animation_translate.c b/src/lib/evas/canvas/efl_animation_translate.c
index 5623fb0e33..2ffc158452 100644
--- a/src/lib/evas/canvas/efl_animation_translate.c
+++ b/src/lib/evas/canvas/efl_animation_translate.c
@@ -163,6 +163,9 @@ _efl_animation_translate_efl_animation_object_create(Eo *eo_obj,
double total_duration = efl_animation_total_duration_get(eo_obj);
efl_animation_object_total_duration_set(anim_obj, total_duration);
+ double start_delay_time = efl_animation_start_delay_get(eo_obj);
+ efl_animation_object_start_delay_set(anim_obj, start_delay_time);
+
int repeat_count = efl_animation_repeat_count_get(eo_obj);
efl_animation_object_repeat_count_set(anim_obj, repeat_count);