summaryrefslogtreecommitdiff
path: root/src/bin/elementary
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-11-10 19:10:02 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-11-20 09:58:27 +0100
commit0792d042e5db4827fb5f50bdf3fcbff11ccd8b2c (patch)
treebc8568693361636deb936733667e9a031764c4d4 /src/bin/elementary
parentfa93893548858b83055e95c9e334f3d5875958be (diff)
elementary: move away from normal player to the new animation mixin
the mixin can handle the same things as the player. Additionally, the usage of the mixin simplifies the animation usage alot. Reviewed-by: Cedric BAIL <cedric.bail@free.fr> Differential Revision: https://phab.enlightenment.org/D10636
Diffstat (limited to 'src/bin/elementary')
-rw-r--r--src/bin/elementary/test_efl_anim_alpha.c45
-rw-r--r--src/bin/elementary/test_efl_anim_group_parallel.c48
-rw-r--r--src/bin/elementary/test_efl_anim_group_sequential.c47
-rw-r--r--src/bin/elementary/test_efl_anim_interpolator.c82
-rw-r--r--src/bin/elementary/test_efl_anim_pause.c68
-rw-r--r--src/bin/elementary/test_efl_anim_repeat.c74
-rw-r--r--src/bin/elementary/test_efl_anim_rotate.c73
-rw-r--r--src/bin/elementary/test_efl_anim_scale.c72
-rw-r--r--src/bin/elementary/test_efl_anim_start_delay.c55
-rw-r--r--src/bin/elementary/test_efl_anim_translate.c57
10 files changed, 259 insertions, 362 deletions
diff --git a/src/bin/elementary/test_efl_anim_alpha.c b/src/bin/elementary/test_efl_anim_alpha.c
index d75733f..b364319 100644
--- a/src/bin/elementary/test_efl_anim_alpha.c
+++ b/src/bin/elementary/test_efl_anim_alpha.c
@@ -7,31 +7,38 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *show_anim; 8 Efl_Canvas_Animation *show_anim;
9 Efl_Canvas_Animation *hide_anim; 9 Efl_Canvas_Animation *hide_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Eina_Bool is_btn_visible; 12 Eina_Bool is_btn_visible;
13} App_Data; 13} App_Data;
14 14
15static void 15static void
16_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 16_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
17{ 17{
18 printf("Animation has been started!\n"); 18 Eo *anim = event->info;
19}
20 19
21static void 20 if (anim)
22_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 21 {
23{ 22 printf("Animation has been started!\n");
24 printf("Animation has been ended!\n"); 23 }
24 else
25 {
26 printf("Animation has been ended!\n");
27 }
25} 28}
26 29
27static void 30static void
28_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 31_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
29{ 32{
30 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 33 double *progress = event->info;
31 double progress = event_running->progress; 34 printf("Animation is running! Current progress(%lf)\n", *progress);
32 printf("Animation is running! Current progress(%lf)\n", progress);
33} 35}
34 36
37EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
38 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
39 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
40)
41
35static void 42static void
36_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 43_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
37{ 44{
@@ -42,18 +49,17 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
42 if (ad->is_btn_visible) 49 if (ad->is_btn_visible)
43 { 50 {
44 //Create Animation Object from Animation 51 //Create Animation Object from Animation
45 efl_animation_player_animation_set(ad->anim_obj, ad->show_anim); 52 efl_canvas_object_animation_start(ad->button, ad->show_anim, 1.0, 0.0);
46 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0"); 53 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
47 } 54 }
48 else 55 else
49 { 56 {
50 //Create Animation Object from Animation 57 //Create Animation Object from Animation
51 efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim); 58 efl_canvas_object_animation_start(ad->button, ad->hide_anim, 1.0, 0.0);
52 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0"); 59 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
53 } 60 }
54 61
55 //Let Animation Object start animation 62 //Let Animation Object start animation
56 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
57} 63}
58 64
59static void 65static void
@@ -81,6 +87,7 @@ test_efl_anim_alpha(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
81 evas_object_resize(btn, 200, 200); 87 evas_object_resize(btn, 200, 200);
82 evas_object_move(btn, 100, 50); 88 evas_object_move(btn, 100, 50);
83 evas_object_show(btn); 89 evas_object_show(btn);
90 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
84 91
85 //Show Animation 92 //Show Animation
86 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win); 93 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win);
@@ -97,16 +104,8 @@ test_efl_anim_alpha(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
97 //Initialize App Data 104 //Initialize App Data
98 ad->show_anim = show_anim; 105 ad->show_anim = show_anim;
99 ad->hide_anim = hide_anim; 106 ad->hide_anim = hide_anim;
100 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win,
101 efl_animation_player_target_set(efl_added, btn));
102
103 //Register callback called when animation starts
104 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
105 //Register callback called when animation ends
106 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
107 //Register callback called while animation is executed
108 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
109 ad->is_btn_visible = EINA_TRUE; 107 ad->is_btn_visible = EINA_TRUE;
108 ad->button = btn;
110 109
111 //Button to start animation 110 //Button to start animation
112 Evas_Object *btn2 = elm_button_add(win); 111 Evas_Object *btn2 = elm_button_add(win);
diff --git a/src/bin/elementary/test_efl_anim_group_parallel.c b/src/bin/elementary/test_efl_anim_group_parallel.c
index 262286a..ed319e5 100644
--- a/src/bin/elementary/test_efl_anim_group_parallel.c
+++ b/src/bin/elementary/test_efl_anim_group_parallel.c
@@ -7,32 +7,38 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *parallel_show_anim; 8 Efl_Canvas_Animation *parallel_show_anim;
9 Efl_Canvas_Animation *parallel_hide_anim; 9 Efl_Canvas_Animation *parallel_hide_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Eina_Bool is_btn_visible; 12 Eina_Bool is_btn_visible;
13} App_Data; 13} App_Data;
14 14
15static void 15static void
16_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 16_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
17{ 17{
18 printf("Animation has been started!\n"); 18 Eo *anim = event->info;
19}
20
21static void
22_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
23{
24 printf("Animation has been ended!\n");
25 19
20 if (anim)
21 {
22 printf("Animation has been started!\n");
23 }
24 else
25 {
26 printf("Animation has been ended!\n");
27 }
26} 28}
27 29
28static void 30static void
29_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 31_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
30{ 32{
31 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 33 double *progress = event->info;
32 double progress = event_running->progress; 34 printf("Animation is running! Current progress(%lf)\n", *progress);
33 printf("Animation is running! Current progress(%lf)\n", progress);
34} 35}
35 36
37EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
38 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
39 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
40)
41
36static void 42static void
37_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 43_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
38{ 44{
@@ -43,18 +49,16 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
43 if (ad->is_btn_visible) 49 if (ad->is_btn_visible)
44 { 50 {
45 //Create Animation Object from Animation 51 //Create Animation Object from Animation
46 efl_animation_player_animation_set(ad->anim_obj, ad->parallel_show_anim); 52 efl_canvas_object_animation_start(ad->button, ad->parallel_show_anim, 1.0, 0.0);
47 efl_text_set(obj, "Start Parallel Group Animation to hide button"); 53 efl_text_set(obj, "Start Parallel Group Animation to hide button");
48 } 54 }
49 else 55 else
50 { 56 {
51 //Create Animation Object from Animation 57 //Create Animation Object from Animation
52 efl_animation_player_animation_set(ad->anim_obj, ad->parallel_hide_anim); 58 efl_canvas_object_animation_start(ad->button, ad->parallel_hide_anim, 1.0, 0.0);
53 efl_text_set(obj, "Start Parallel Group Animation to show button"); 59 efl_text_set(obj, "Start Parallel Group Animation to show button");
54 } 60 }
55 61
56 //Let Animation Object start animation
57 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
58} 62}
59 63
60static void 64static void
@@ -82,7 +86,7 @@ test_efl_anim_group_parallel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
82 evas_object_resize(btn, 150, 150); 86 evas_object_resize(btn, 150, 150);
83 evas_object_move(btn, 125, 100); 87 evas_object_move(btn, 125, 100);
84 evas_object_show(btn); 88 evas_object_show(btn);
85 89 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
86 90
87 //Show Animation 91 //Show Animation
88 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win); 92 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win);
@@ -133,15 +137,7 @@ test_efl_anim_group_parallel(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
133 //Initialize App Data 137 //Initialize App Data
134 ad->parallel_show_anim = parallel_show_anim; 138 ad->parallel_show_anim = parallel_show_anim;
135 ad->parallel_hide_anim = parallel_hide_anim; 139 ad->parallel_hide_anim = parallel_hide_anim;
136 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 140 ad->button = btn;
137 efl_animation_player_target_set(efl_added, btn));
138
139 //Register callback called when animation starts
140 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
141 //Register callback called when animation ends
142 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
143 //Register callback called while animation is executed
144 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
145 141
146 ad->is_btn_visible = EINA_TRUE; 142 ad->is_btn_visible = EINA_TRUE;
147 143
diff --git a/src/bin/elementary/test_efl_anim_group_sequential.c b/src/bin/elementary/test_efl_anim_group_sequential.c
index 4beefb2..37b4e53 100644
--- a/src/bin/elementary/test_efl_anim_group_sequential.c
+++ b/src/bin/elementary/test_efl_anim_group_sequential.c
@@ -7,31 +7,38 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *sequential_show_anim; 8 Efl_Canvas_Animation *sequential_show_anim;
9 Efl_Canvas_Animation *sequential_hide_anim; 9 Efl_Canvas_Animation *sequential_hide_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Eina_Bool is_btn_visible; 12 Eina_Bool is_btn_visible;
13} App_Data; 13} App_Data;
14 14
15static void 15static void
16_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 16_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
17{ 17{
18 printf("Animation has been started!\n"); 18 Eo *anim = event->info;
19}
20 19
21static void 20 if (anim)
22_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 21 {
23{ 22 printf("Animation has been started!\n");
24 printf("Animation has been ended!\n"); 23 }
24 else
25 {
26 printf("Animation has been ended!\n");
27 }
25} 28}
26 29
27static void 30static void
28_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 31_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
29{ 32{
30 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 33 double *progress = event->info;
31 double progress = event_running->progress; 34 printf("Animation is running! Current progress(%lf)\n", *progress);
32 printf("Animation is running! Current progress(%lf)\n", progress);
33} 35}
34 36
37EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
38 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
39 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
40)
41
35static void 42static void
36_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 43_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
37{ 44{
@@ -42,18 +49,15 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
42 if (ad->is_btn_visible) 49 if (ad->is_btn_visible)
43 { 50 {
44 //Create Animation Object from Animation 51 //Create Animation Object from Animation
45 efl_animation_player_animation_set(ad->anim_obj, ad->sequential_show_anim); 52 efl_canvas_object_animation_start(ad->button, ad->sequential_show_anim, 1.0, 0.0);
46 efl_text_set(obj, "Start Sequential Group Animation to hide button"); 53 efl_text_set(obj, "Start Sequential Group Animation to hide button");
47 } 54 }
48 else 55 else
49 { 56 {
50 //Create Animation Object from Animation 57 //Create Animation Object from Animation
51 efl_animation_player_animation_set(ad->anim_obj, ad->sequential_hide_anim); 58 efl_canvas_object_animation_start(ad->button, ad->sequential_hide_anim, 1.0, 0.0);
52 efl_text_set(obj, "Start Sequential Group Animation to show button"); 59 efl_text_set(obj, "Start Sequential Group Animation to show button");
53 } 60 }
54
55 //Let Animation Object start animation
56 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
57} 61}
58 62
59static void 63static void
@@ -81,6 +85,7 @@ test_efl_anim_group_sequential(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
81 evas_object_resize(btn, 150, 150); 85 evas_object_resize(btn, 150, 150);
82 evas_object_move(btn, 125, 100); 86 evas_object_move(btn, 125, 100);
83 evas_object_show(btn); 87 evas_object_show(btn);
88 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
84 89
85 90
86 /* Animations to hide button */ 91 /* Animations to hide button */
@@ -138,15 +143,7 @@ test_efl_anim_group_sequential(void *data EINA_UNUSED, Evas_Object *obj EINA_UNU
138 //Initialize App Data 143 //Initialize App Data
139 ad->sequential_show_anim = sequential_show_anim; 144 ad->sequential_show_anim = sequential_show_anim;
140 ad->sequential_hide_anim = sequential_hide_anim; 145 ad->sequential_hide_anim = sequential_hide_anim;
141 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 146 ad->button = btn;
142 efl_animation_player_target_set(efl_added, btn));
143
144 //Register callback called when animation starts
145 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
146 //Register callback called when animation ends
147 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
148 //Register callback called while animation is executed
149 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
150 147
151 ad->is_btn_visible = EINA_TRUE; 148 ad->is_btn_visible = EINA_TRUE;
152 149
diff --git a/src/bin/elementary/test_efl_anim_interpolator.c b/src/bin/elementary/test_efl_anim_interpolator.c
index 96c7649..c5a828f 100644
--- a/src/bin/elementary/test_efl_anim_interpolator.c
+++ b/src/bin/elementary/test_efl_anim_interpolator.c
@@ -13,7 +13,7 @@
13typedef struct _App_Data 13typedef struct _App_Data
14{ 14{
15 Efl_Canvas_Animation *anim[INTERP_NUM]; 15 Efl_Canvas_Animation *anim[INTERP_NUM];
16 Efl_Canvas_Animation_Player *anim_obj[INTERP_NUM]; 16 Efl_Ui_Button *btns[INTERP_NUM];
17 17
18 Evas_Object *btn[INTERP_NUM]; 18 Evas_Object *btn[INTERP_NUM];
19 Evas_Object *start_all_btn; 19 Evas_Object *start_all_btn;
@@ -68,46 +68,49 @@ _interpolator_create(int index, Evas_Object *win)
68} 68}
69 69
70static void 70static void
71_anim_started_cb(void *data, const Efl_Event *event EINA_UNUSED) 71_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
72{ 72{
73 Eo *anim = event->info;
73 App_Data *ad = data; 74 App_Data *ad = data;
74 75
75 printf("Animation has been started!\n"); 76 if (anim)
76 77 {
77 ad->running_anim_cnt++; 78 printf("Animation has been started!\n");
78} 79 ad->running_anim_cnt++;
79 80 }
80static void 81 else
81_anim_ended_cb(void *data, const Efl_Event *event) 82 {
82{ 83 int i;
83 App_Data *ad = data;
84 int i;
85
86 printf("Animation has been ended!\n");
87 84
88 ad->running_anim_cnt--; 85 printf("Animation has been ended!\n");
86 ad->running_anim_cnt--;
89 87
90 for (i = 0; i < INTERP_NUM; i++) 88 for (i = 0; i < INTERP_NUM; i++)
91 {
92 if (ad->anim_obj[i] == event->object)
93 { 89 {
94 elm_object_disabled_set(ad->btn[i], EINA_FALSE); 90 if (ad->btns[i] == event->object)
95 break; 91 {
92 elm_object_disabled_set(ad->btn[i], EINA_FALSE);
93 break;
94 }
96 } 95 }
97 }
98 96
99 if (ad->running_anim_cnt == 0) 97 if (ad->running_anim_cnt == 0)
100 elm_object_disabled_set(ad->start_all_btn, EINA_FALSE); 98 elm_object_disabled_set(ad->start_all_btn, EINA_FALSE);
99 }
101} 100}
102 101
103static void 102static void
104_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 103_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
105{ 104{
106 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 105 double *progress = event->info;
107 double progress = event_running->progress; 106 printf("Animation is running! Current progress(%lf)\n", *progress);
108 printf("Animation is running! Current progress(%lf)\n", progress);
109} 107}
110 108
109EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
110 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
111 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
112)
113
111static void 114static void
112_anim_start(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 115_anim_start(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
113{ 116{
@@ -116,7 +119,7 @@ _anim_start(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
116 int index = (uintptr_t)evas_object_data_get(obj, "index"); 119 int index = (uintptr_t)evas_object_data_get(obj, "index");
117 120
118 //Let Animation Object start animation 121 //Let Animation Object start animation
119 efl_player_playing_set(ad->anim_obj[index], EINA_TRUE); 122 efl_canvas_object_animation_start(ad->btns[index], ad->anim[index], 1.0, 0.0);
120 123
121 elm_object_disabled_set(obj, EINA_TRUE); 124 elm_object_disabled_set(obj, EINA_TRUE);
122 elm_object_disabled_set(ad->start_all_btn, EINA_TRUE); 125 elm_object_disabled_set(ad->start_all_btn, EINA_TRUE);
@@ -131,7 +134,7 @@ _anim_start_all(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
131 for (i = 0; i < INTERP_NUM; i++) 134 for (i = 0; i < INTERP_NUM; i++)
132 { 135 {
133 //Let Animation Object start animation 136 //Let Animation Object start animation
134 efl_player_playing_set(ad->anim_obj[i], EINA_TRUE); 137 efl_canvas_object_animation_start(ad->btns[i], ad->anim[i], 1.0, 0.0);
135 elm_object_disabled_set(ad->btn[i], EINA_TRUE); 138 elm_object_disabled_set(ad->btn[i], EINA_TRUE);
136 } 139 }
137 140
@@ -147,9 +150,7 @@ _win_del_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUS
147 for (i = 0; i < INTERP_NUM; i++) 150 for (i = 0; i < INTERP_NUM; i++)
148 { 151 {
149 //Unregister callback called when window deletes 152 //Unregister callback called when window deletes
150 efl_event_callback_del(ad->anim_obj[i], 153 efl_event_callback_array_del(ad->btns[i], animation_stats_cb(), ad);
151 EFL_ANIMATION_PLAYER_EVENT_ENDED,
152 _anim_ended_cb, ad);
153 } 154 }
154 155
155 free(ad); 156 free(ad);
@@ -211,23 +212,8 @@ test_efl_anim_interpolator(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
211 ad->anim[i] = anim; 212 ad->anim[i] = anim;
212 213
213 //Create Animation Object from Animation 214 //Create Animation Object from Animation
214 Efl_Canvas_Animation_Player *anim_obj = 215 ad->btns[i] = btn;
215 efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 216 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
216 efl_animation_player_animation_set(efl_added, anim),
217 efl_animation_player_target_set(efl_added, btn));
218 ad->anim_obj[i] = anim_obj;
219
220 //Register callback called when animation starts
221 efl_event_callback_add(anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED,
222 _anim_started_cb, ad);
223
224 //Register callback called when animation ends
225 efl_event_callback_add(anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED,
226 _anim_ended_cb, ad);
227
228 //Register callback called while animation is executed
229 efl_event_callback_add(anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING,
230 _anim_running_cb, NULL);
231 } 217 }
232 218
233 ad->running_anim_cnt = 0; 219 ad->running_anim_cnt = 0;
diff --git a/src/bin/elementary/test_efl_anim_pause.c b/src/bin/elementary/test_efl_anim_pause.c
index 3730db3..92d4b3e 100644
--- a/src/bin/elementary/test_efl_anim_pause.c
+++ b/src/bin/elementary/test_efl_anim_pause.c
@@ -7,7 +7,7 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *show_anim; 8 Efl_Canvas_Animation *show_anim;
9 Efl_Canvas_Animation *hide_anim; 9 Efl_Canvas_Animation *hide_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Evas_Object *pause_btn; 12 Evas_Object *pause_btn;
13 13
@@ -16,60 +16,54 @@ typedef struct _App_Data
16} App_Data; 16} App_Data;
17 17
18static void 18static void
19_anim_started_cb(void *data, const Efl_Event *event EINA_UNUSED) 19_anim_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
20{ 20{
21 Eo *anim = event->info;
21 App_Data *ad = data; 22 App_Data *ad = data;
22 23
23 printf("Animation has been started!\n"); 24 if (anim)
24 25 {
25 elm_object_disabled_set(ad->pause_btn, EINA_FALSE); 26 printf("Animation has been started!\n");
26} 27 elm_object_disabled_set(ad->pause_btn, EINA_FALSE);
27 28 }
28static void 29 else
29_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED) 30 {
30{ 31 printf("Animation has been ended!\n");
31 App_Data *ad = data; 32 elm_object_disabled_set(ad->pause_btn, EINA_TRUE);
32 33 }
33 printf("Animation has been ended!\n");
34
35 elm_object_disabled_set(ad->pause_btn, EINA_TRUE);
36} 34}
37 35
38static void 36static void
39_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 37_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
40{ 38{
41 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 39 double *progress = event->info;
42 double progress = event_running->progress; 40 printf("Animation is running! Current progress(%lf)\n", *progress);
43 printf("Animation is running! Current progress(%lf)\n", progress);
44} 41}
45 42
43EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
44 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
45 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
46)
47
46static void 48static void
47_start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 49_start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
48{ 50{
49 App_Data *ad = data; 51 App_Data *ad = data;
50 52
51 if (ad->anim_obj)
52 {
53 ad->is_anim_paused = EINA_FALSE;
54 elm_object_text_set(ad->pause_btn, "Pause Animation");
55 }
56
57 ad->is_btn_visible = !(ad->is_btn_visible); 53 ad->is_btn_visible = !(ad->is_btn_visible);
58 54
59 if (ad->is_btn_visible) 55 if (ad->is_btn_visible)
60 { 56 {
61 //Create Animation Object from Animation 57 //Create Animation Object from Animation
62 efl_animation_player_animation_set(ad->anim_obj, ad->show_anim); 58 efl_canvas_object_animation_start(ad->button, ad->show_anim, 1.0, 0.0);
63 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0"); 59 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
64 } 60 }
65 else 61 else
66 { 62 {
67 //Create Animation Object from Animation 63 //Create Animation Object from Animation
68 efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim); 64 efl_canvas_object_animation_start(ad->button, ad->hide_anim, 1.0, 0.0);
69 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0"); 65 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
70 } 66 }
71 //Let Animation Object start animation
72 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
73} 67}
74 68
75static void 69static void
@@ -82,13 +76,13 @@ _pause_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
82 if (ad->is_anim_paused) 76 if (ad->is_anim_paused)
83 { 77 {
84 //Pause animation 78 //Pause animation
85 efl_player_paused_set(ad->anim_obj, EINA_TRUE); 79 efl_canvas_object_animation_pause_set(ad->button, EINA_TRUE);
86 elm_object_text_set(obj, "Resume Animation"); 80 elm_object_text_set(obj, "Resume Animation");
87 } 81 }
88 else 82 else
89 { 83 {
90 //Resume animation 84 //Resume animation
91 efl_player_paused_set(ad->anim_obj, EINA_FALSE); 85 efl_canvas_object_animation_pause_set(ad->button, EINA_FALSE);
92 elm_object_text_set(obj, "Pause Animation"); 86 elm_object_text_set(obj, "Pause Animation");
93 } 87 }
94} 88}
@@ -118,6 +112,7 @@ test_efl_anim_pause(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
118 evas_object_resize(btn, 200, 200); 112 evas_object_resize(btn, 200, 200);
119 evas_object_move(btn, 100, 50); 113 evas_object_move(btn, 100, 50);
120 evas_object_show(btn); 114 evas_object_show(btn);
115 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
121 116
122 //Show Animation 117 //Show Animation
123 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win); 118 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win);
@@ -152,25 +147,14 @@ test_efl_anim_pause(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
152 //Pause button becomes enabled only if the animation is started 147 //Pause button becomes enabled only if the animation is started
153 elm_object_disabled_set(pause_btn, EINA_TRUE); 148 elm_object_disabled_set(pause_btn, EINA_TRUE);
154 149
155
156 //Initialize App Data 150 //Initialize App Data
157 ad->show_anim = show_anim; 151 ad->show_anim = show_anim;
158 ad->hide_anim = hide_anim; 152 ad->hide_anim = hide_anim;
159 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 153 ad->button = btn;
160 efl_animation_player_target_set(efl_added, btn));
161
162 //Register callback called when animation starts
163 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, ad);
164 //Register callback called when animation ends
165 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
166 //Register callback called while animation is executed
167 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
168
169 ad->pause_btn = pause_btn; 154 ad->pause_btn = pause_btn;
170 ad->is_btn_visible = EINA_TRUE; 155 ad->is_btn_visible = EINA_TRUE;
171 ad->is_anim_paused = EINA_FALSE; 156 ad->is_anim_paused = EINA_FALSE;
172 157
173
174 evas_object_resize(win, 400, 450); 158 evas_object_resize(win, 400, 450);
175 evas_object_show(win); 159 evas_object_show(win);
176} 160}
diff --git a/src/bin/elementary/test_efl_anim_repeat.c b/src/bin/elementary/test_efl_anim_repeat.c
index 55bf98c..0f72882 100644
--- a/src/bin/elementary/test_efl_anim_repeat.c
+++ b/src/bin/elementary/test_efl_anim_repeat.c
@@ -7,7 +7,7 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *show_anim; 8 Efl_Canvas_Animation *show_anim;
9 Efl_Canvas_Animation *hide_anim; 9 Efl_Canvas_Animation *hide_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Evas_Object *start_btn; 12 Evas_Object *start_btn;
13 Evas_Object *repeat_count_spin; 13 Evas_Object *repeat_count_spin;
@@ -27,46 +27,50 @@ _anim_repeat_mode_get(Evas_Object *spinner)
27 return EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE; 27 return EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE;
28} 28}
29 29
30static void
31_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
32{
33 printf("Animation has been started!\n");
34}
35 30
36static void 31static void
37_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED) 32_anim_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
38{ 33{
34 Eo *anim = event->info;
39 App_Data *ad = data; 35 App_Data *ad = data;
40 36
41 printf("Animation has been ended!\n"); 37 if (anim)
42 38 {
43 Efl_Canvas_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin); 39 printf("Animation has been started!\n");
44 if (repeat_mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) 40 }
41 else
45 { 42 {
46 int repeat_count = elm_spinner_value_get(ad->repeat_count_spin); 43 printf("Animation has been ended!\n");
47 if (repeat_count % 2 == 1) 44 Efl_Canvas_Animation_Repeat_Mode repeat_mode = _anim_repeat_mode_get(ad->repeat_mode_spin);
45 if (repeat_mode == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
48 { 46 {
49 ad->is_btn_visible = !(ad->is_btn_visible); 47 int repeat_count = elm_spinner_value_get(ad->repeat_count_spin);
50 48 if (repeat_count % 2 == 1)
51 if (ad->is_btn_visible) 49 {
52 elm_object_text_set(ad->start_btn, "Start Alpha Animation from 1.0 to 0.0"); 50 ad->is_btn_visible = !(ad->is_btn_visible);
53 else 51 if (ad->is_btn_visible)
54 elm_object_text_set(ad->start_btn, "Start Alpha Animation from 0.0 to 1.0"); 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 }
55 } 56 }
57 elm_object_disabled_set(ad->repeat_count_spin, EINA_FALSE);
58 elm_object_disabled_set(ad->repeat_mode_spin, EINA_FALSE);
56 } 59 }
57
58 elm_object_disabled_set(ad->repeat_count_spin, EINA_FALSE);
59 elm_object_disabled_set(ad->repeat_mode_spin, EINA_FALSE);
60} 60}
61 61
62static void 62static void
63_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 63_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
64{ 64{
65 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 65 double *progress = event->info;
66 double progress = event_running->progress; 66 printf("Animation is running! Current progress(%lf)\n", *progress);
67 printf("Animation is running! Current progress(%lf)\n", progress);
68} 67}
69 68
69EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
70 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
71 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
72)
73
70static void 74static void
71_start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 75_start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
72{ 76{
@@ -89,7 +93,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
89 efl_animation_repeat_mode_set(ad->show_anim, repeat_mode); 93 efl_animation_repeat_mode_set(ad->show_anim, repeat_mode);
90 94
91 //Create Animation Object from Animation 95 //Create Animation Object from Animation
92 efl_animation_player_animation_set(ad->anim_obj, ad->show_anim); 96 efl_canvas_object_animation_start(ad->button, ad->show_anim, 1.0, 0.0);
93 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0"); 97 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
94 } 98 }
95 else 99 else
@@ -101,12 +105,9 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
101 efl_animation_repeat_mode_set(ad->hide_anim, repeat_mode); 105 efl_animation_repeat_mode_set(ad->hide_anim, repeat_mode);
102 106
103 //Create Animation Object from Animation 107 //Create Animation Object from Animation
104 efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim); 108 efl_canvas_object_animation_start(ad->button, ad->hide_anim, 1.0, 0.0);
105 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0"); 109 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
106 } 110 }
107
108 //Let Animation Object start animation
109 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
110} 111}
111 112
112static void 113static void
@@ -133,6 +134,7 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
133 evas_object_resize(btn, 200, 200); 134 evas_object_resize(btn, 200, 200);
134 evas_object_move(btn, 100, 50); 135 evas_object_move(btn, 100, 50);
135 evas_object_show(btn); 136 evas_object_show(btn);
137 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
136 138
137 //Show Animation 139 //Show Animation
138 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win); 140 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win);
@@ -178,24 +180,14 @@ test_efl_anim_repeat(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
178 evas_object_move(repeat_mode_spin, 100, 400); 180 evas_object_move(repeat_mode_spin, 100, 400);
179 evas_object_show(repeat_mode_spin); 181 evas_object_show(repeat_mode_spin);
180 182
181
182 //Initialize App Data 183 //Initialize App Data
183 ad->show_anim = show_anim; 184 ad->show_anim = show_anim;
184 ad->hide_anim = hide_anim; 185 ad->hide_anim = hide_anim;
185 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win,
186 efl_animation_player_target_set(efl_added, btn));
187 //Register callback called when animation starts
188 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
189 //Register callback called when animation ends
190 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
191 //Register callback called while animation is executed
192 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
193
194 ad->start_btn = start_btn; 186 ad->start_btn = start_btn;
195 ad->repeat_count_spin = repeat_count_spin; 187 ad->repeat_count_spin = repeat_count_spin;
196 ad->repeat_mode_spin = repeat_mode_spin; 188 ad->repeat_mode_spin = repeat_mode_spin;
197 ad->is_btn_visible = EINA_TRUE; 189 ad->is_btn_visible = EINA_TRUE;
198 190 ad->button = btn;
199 191
200 evas_object_resize(win, 400, 500); 192 evas_object_resize(win, 400, 500);
201 evas_object_show(win); 193 evas_object_show(win);
diff --git a/src/bin/elementary/test_efl_anim_rotate.c b/src/bin/elementary/test_efl_anim_rotate.c
index ea8b94a..437d015 100644
--- a/src/bin/elementary/test_efl_anim_rotate.c
+++ b/src/bin/elementary/test_efl_anim_rotate.c
@@ -7,31 +7,38 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *cw_45_degrees_anim; 8 Efl_Canvas_Animation *cw_45_degrees_anim;
9 Efl_Canvas_Animation *ccw_45_degrees_anim; 9 Efl_Canvas_Animation *ccw_45_degrees_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Eina_Bool is_btn_rotated; 12 Eina_Bool is_btn_rotated;
13} App_Data; 13} App_Data;
14 14
15static void 15static void
16_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 16_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
17{ 17{
18 printf("Animation has been started!\n"); 18 Eo *anim = event->info;
19}
20 19
21static void 20 if (anim)
22_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 21 {
23{ 22 printf("Animation has been started!\n");
24 printf("Animation has been ended!\n"); 23 }
24 else
25 {
26 printf("Animation has been ended!\n");
27 }
25} 28}
26 29
27static void 30static void
28_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 31_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
29{ 32{
30 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 33 double *progress = event->info;
31 double progress = event_running->progress; 34 printf("Animation is running! Current progress(%lf)\n", *progress);
32 printf("Animation is running! Current progress(%lf)\n", progress);
33} 35}
34 36
37EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
38 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
39 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
40)
41
35static void 42static void
36_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 43_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
37{ 44{
@@ -42,18 +49,15 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
42 if (ad->is_btn_rotated) 49 if (ad->is_btn_rotated)
43 { 50 {
44 //Create Animation Object from Animation 51 //Create Animation Object from Animation
45 efl_animation_player_animation_set(ad->anim_obj, ad->cw_45_degrees_anim); 52 efl_canvas_object_animation_start(ad->button, ad->cw_45_degrees_anim, 1.0, 0.0);
46 efl_text_set(obj, "Start Rotate Animation from 45 to 0 degrees"); 53 efl_text_set(obj, "Start Rotate Animation from 45 to 0 degrees");
47 } 54 }
48 else 55 else
49 { 56 {
50 //Create Animation Object from Animation 57 //Create Animation Object from Animation
51 efl_animation_player_animation_set(ad->anim_obj, ad->ccw_45_degrees_anim); 58 efl_canvas_object_animation_start(ad->button, ad->ccw_45_degrees_anim, 1.0, 0.0);
52 efl_text_set(obj, "Start Rotate Animation from 0 to 45 degrees"); 59 efl_text_set(obj, "Start Rotate Animation from 0 to 45 degrees");
53 } 60 }
54
55 //Let Animation Object start animation
56 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
57} 61}
58 62
59static void 63static void
@@ -81,6 +85,7 @@ test_efl_anim_rotate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
81 evas_object_resize(btn, 150, 150); 85 evas_object_resize(btn, 150, 150);
82 evas_object_move(btn, 125, 100); 86 evas_object_move(btn, 125, 100);
83 evas_object_show(btn); 87 evas_object_show(btn);
88 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
84 89
85 //Rotate from 0 to 45 degrees Animation 90 //Rotate from 0 to 45 degrees Animation
86 Efl_Canvas_Animation *cw_45_degrees_anim = efl_add(EFL_CANVAS_ANIMATION_ROTATE_CLASS, win); 91 Efl_Canvas_Animation *cw_45_degrees_anim = efl_add(EFL_CANVAS_ANIMATION_ROTATE_CLASS, win);
@@ -97,16 +102,7 @@ test_efl_anim_rotate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
97 //Initialize App Data 102 //Initialize App Data
98 ad->cw_45_degrees_anim = cw_45_degrees_anim; 103 ad->cw_45_degrees_anim = cw_45_degrees_anim;
99 ad->ccw_45_degrees_anim = ccw_45_degrees_anim; 104 ad->ccw_45_degrees_anim = ccw_45_degrees_anim;
100 105 ad->button = btn;
101 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win,
102 efl_animation_player_target_set(efl_added, btn));
103 //Register callback called when animation starts
104 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
105 //Register callback called when animation ends
106 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
107 //Register callback called while animation is executed
108 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
109
110 ad->is_btn_rotated = EINA_FALSE; 106 ad->is_btn_rotated = EINA_FALSE;
111 107
112 //Button to start animation 108 //Button to start animation
@@ -140,6 +136,7 @@ test_efl_anim_rotate_relative(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
140 evas_object_resize(btn, 150, 150); 136 evas_object_resize(btn, 150, 150);
141 evas_object_move(btn, 125, 100); 137 evas_object_move(btn, 125, 100);
142 evas_object_show(btn); 138 evas_object_show(btn);
139 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
143 140
144 //Pivot to be center of the rotation 141 //Pivot to be center of the rotation
145 Evas_Object *pivot = elm_button_add(win); 142 Evas_Object *pivot = elm_button_add(win);
@@ -164,18 +161,8 @@ test_efl_anim_rotate_relative(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
164 //Initialize App Data 161 //Initialize App Data
165 ad->cw_45_degrees_anim = cw_45_degrees_anim; 162 ad->cw_45_degrees_anim = cw_45_degrees_anim;
166 ad->ccw_45_degrees_anim = ccw_45_degrees_anim; 163 ad->ccw_45_degrees_anim = ccw_45_degrees_anim;
167 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win,
168 efl_animation_player_target_set(efl_added, btn));
169
170 //Register callback called when animation starts
171 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
172
173 //Register callback called when animation ends
174 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
175
176 //Register callback called while animation is executed
177 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
178 ad->is_btn_rotated = EINA_FALSE; 164 ad->is_btn_rotated = EINA_FALSE;
165 ad->button = btn;
179 166
180 //Button to start animation 167 //Button to start animation
181 Evas_Object *btn2 = elm_button_add(win); 168 Evas_Object *btn2 = elm_button_add(win);
@@ -208,6 +195,7 @@ test_efl_anim_rotate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
208 evas_object_resize(btn, 150, 150); 195 evas_object_resize(btn, 150, 150);
209 evas_object_move(btn, 125, 100); 196 evas_object_move(btn, 125, 100);
210 evas_object_show(btn); 197 evas_object_show(btn);
198 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
211 199
212 //Absolute coordinate (0, 0) to be center of the rotation 200 //Absolute coordinate (0, 0) to be center of the rotation
213 Evas_Object *abs_center = elm_button_add(win); 201 Evas_Object *abs_center = elm_button_add(win);
@@ -232,17 +220,8 @@ test_efl_anim_rotate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUS
232 //Initialize App Data 220 //Initialize App Data
233 ad->cw_45_degrees_anim = cw_45_degrees_anim; 221 ad->cw_45_degrees_anim = cw_45_degrees_anim;
234 ad->ccw_45_degrees_anim = ccw_45_degrees_anim; 222 ad->ccw_45_degrees_anim = ccw_45_degrees_anim;
235 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win,
236 efl_animation_player_target_set(efl_added, btn));
237
238 //Register callback called when animation starts
239 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
240 //Register callback called when animation ends
241 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
242 //Register callback called while animation is executed
243 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
244
245 ad->is_btn_rotated = EINA_FALSE; 223 ad->is_btn_rotated = EINA_FALSE;
224 ad->button = btn;
246 225
247 //Button to start animation 226 //Button to start animation
248 Evas_Object *btn2 = elm_button_add(win); 227 Evas_Object *btn2 = elm_button_add(win);
diff --git a/src/bin/elementary/test_efl_anim_scale.c b/src/bin/elementary/test_efl_anim_scale.c
index d3812de..93ac1f7 100644
--- a/src/bin/elementary/test_efl_anim_scale.c
+++ b/src/bin/elementary/test_efl_anim_scale.c
@@ -7,31 +7,38 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *scale_double_anim; 8 Efl_Canvas_Animation *scale_double_anim;
9 Efl_Canvas_Animation *scale_half_anim; 9 Efl_Canvas_Animation *scale_half_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Eina_Bool is_btn_scaled; 12 Eina_Bool is_btn_scaled;
13} App_Data; 13} App_Data;
14 14
15static void 15static void
16_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 16_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
17{ 17{
18 printf("Animation has been started!\n"); 18 Eo *anim = event->info;
19}
20 19
21static void 20 if (anim)
22_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 21 {
23{ 22 printf("Animation has been started!\n");
24 printf("Animation has been ended!\n"); 23 }
24 else
25 {
26 printf("Animation has been ended!\n");
27 }
25} 28}
26 29
27static void 30static void
28_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 31_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
29{ 32{
30 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 33 double *progress = event->info;
31 double progress = event_running->progress; 34 printf("Animation is running! Current progress(%lf)\n", *progress);
32 printf("Animation is running! Current progress(%lf)\n", progress);
33} 35}
34 36
37EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
38 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
39 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
40)
41
35static void 42static void
36_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 43_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
37{ 44{
@@ -42,18 +49,15 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
42 if (ad->is_btn_scaled) 49 if (ad->is_btn_scaled)
43 { 50 {
44 //Create Animation Object from Animation 51 //Create Animation Object from Animation
45 efl_animation_player_animation_set(ad->anim_obj, ad->scale_double_anim); 52 efl_canvas_object_animation_start(ad->button, ad->scale_double_anim, 1.0, 0.0);
46 efl_text_set(obj, "Start Scale Animation to zoom out"); 53 efl_text_set(obj, "Start Scale Animation to zoom out");
47 } 54 }
48 else 55 else
49 { 56 {
50 //Create Animation Object from Animation 57 //Create Animation Object from Animation
51 efl_animation_player_animation_set(ad->anim_obj, ad->scale_half_anim); 58 efl_canvas_object_animation_start(ad->button, ad->scale_half_anim, 1.0, 0.0);
52 efl_text_set(obj, "Start Scale Animation to zoom in"); 59 efl_text_set(obj, "Start Scale Animation to zoom in");
53 } 60 }
54
55 //Let Animation Object start animation
56 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
57} 61}
58 62
59static void 63static void
@@ -81,6 +85,7 @@ test_efl_anim_scale(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
81 evas_object_resize(btn, 150, 150); 85 evas_object_resize(btn, 150, 150);
82 evas_object_move(btn, 125, 100); 86 evas_object_move(btn, 125, 100);
83 evas_object_show(btn); 87 evas_object_show(btn);
88 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
84 89
85 //Scale Animation to zoom in 90 //Scale Animation to zoom in
86 Efl_Canvas_Animation *scale_double_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win); 91 Efl_Canvas_Animation *scale_double_anim = efl_add(EFL_CANVAS_ANIMATION_SCALE_CLASS, win);
@@ -97,19 +102,8 @@ test_efl_anim_scale(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *
97 //Initialize App Data 102 //Initialize App Data
98 ad->scale_double_anim = scale_double_anim; 103 ad->scale_double_anim = scale_double_anim;
99 ad->scale_half_anim = scale_half_anim; 104 ad->scale_half_anim = scale_half_anim;
100 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win,
101 efl_animation_player_target_set(efl_added, btn));
102
103 //Register callback called when animation starts
104 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
105
106 //Register callback called when animation ends
107 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
108
109 //Register callback called while animation is executed
110 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
111
112 ad->is_btn_scaled = EINA_FALSE; 105 ad->is_btn_scaled = EINA_FALSE;
106 ad->button = btn;
113 107
114 //Button to start animation 108 //Button to start animation
115 Evas_Object *btn2 = elm_button_add(win); 109 Evas_Object *btn2 = elm_button_add(win);
@@ -142,6 +136,7 @@ test_efl_anim_scale_relative(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
142 evas_object_resize(btn, 150, 150); 136 evas_object_resize(btn, 150, 150);
143 evas_object_move(btn, 125, 100); 137 evas_object_move(btn, 125, 100);
144 evas_object_show(btn); 138 evas_object_show(btn);
139 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
145 140
146 //Pivot to be center of the scaling 141 //Pivot to be center of the scaling
147 Evas_Object *pivot = elm_button_add(win); 142 Evas_Object *pivot = elm_button_add(win);
@@ -166,15 +161,7 @@ test_efl_anim_scale_relative(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
166 //Initialize App Data 161 //Initialize App Data
167 ad->scale_double_anim = scale_double_anim; 162 ad->scale_double_anim = scale_double_anim;
168 ad->scale_half_anim = scale_half_anim; 163 ad->scale_half_anim = scale_half_anim;
169 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 164 ad->button = btn;
170 efl_animation_player_target_set(efl_added, btn));
171 //Register callback called when animation starts
172 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
173 //Register callback called when animation ends
174 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
175 //Register callback called while animation is executed
176 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
177
178 ad->is_btn_scaled = EINA_FALSE; 165 ad->is_btn_scaled = EINA_FALSE;
179 166
180 //Button to start animation 167 //Button to start animation
@@ -208,6 +195,7 @@ test_efl_anim_scale_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
208 evas_object_resize(btn, 150, 150); 195 evas_object_resize(btn, 150, 150);
209 evas_object_move(btn, 125, 100); 196 evas_object_move(btn, 125, 100);
210 evas_object_show(btn); 197 evas_object_show(btn);
198 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
211 199
212 //Absolute coordinate (0, 0) to be center of the scaling 200 //Absolute coordinate (0, 0) to be center of the scaling
213 Evas_Object *abs_center = elm_button_add(win); 201 Evas_Object *abs_center = elm_button_add(win);
@@ -232,15 +220,7 @@ test_efl_anim_scale_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSE
232 //Initialize App Data 220 //Initialize App Data
233 ad->scale_double_anim = scale_double_anim; 221 ad->scale_double_anim = scale_double_anim;
234 ad->scale_half_anim = scale_half_anim; 222 ad->scale_half_anim = scale_half_anim;
235 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 223 ad->button = btn;
236 efl_animation_player_target_set(efl_added, btn));
237 //Register callback called when animation starts
238 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
239 //Register callback called when animation ends
240 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
241 //Register callback called while animation is executed
242 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
243
244 ad->is_btn_scaled = EINA_FALSE; 224 ad->is_btn_scaled = EINA_FALSE;
245 225
246 //Button to start animation 226 //Button to start animation
diff --git a/src/bin/elementary/test_efl_anim_start_delay.c b/src/bin/elementary/test_efl_anim_start_delay.c
index e3c7b25..6ef663b 100644
--- a/src/bin/elementary/test_efl_anim_start_delay.c
+++ b/src/bin/elementary/test_efl_anim_start_delay.c
@@ -7,7 +7,7 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *show_anim; 8 Efl_Canvas_Animation *show_anim;
9 Efl_Canvas_Animation *hide_anim; 9 Efl_Canvas_Animation *hide_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Evas_Object *start_delay_spin; 12 Evas_Object *start_delay_spin;
13 13
@@ -15,29 +15,35 @@ typedef struct _App_Data
15} App_Data; 15} App_Data;
16 16
17static void 17static void
18_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 18_anim_changed_cb(void *data, const Efl_Event *event EINA_UNUSED)
19{
20 printf("Animation has been started!\n");
21}
22
23static void
24_anim_ended_cb(void *data, const Efl_Event *event EINA_UNUSED)
25{ 19{
20 Eo *anim = event->info;
26 App_Data *ad = data; 21 App_Data *ad = data;
27 22
28 printf("Animation has been ended!\n"); 23 if (anim)
29 24 {
30 elm_object_disabled_set(ad->start_delay_spin, EINA_FALSE); 25 printf("Animation has been started!\n");
26 elm_object_disabled_set(ad->start_delay_spin, EINA_FALSE);
27 }
28 else
29 {
30 printf("Animation has been ended!\n");
31 elm_object_disabled_set(ad->start_delay_spin, EINA_TRUE);
32 }
31} 33}
32 34
33static void 35static void
34_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 36_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
35{ 37{
36 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 38 double *progress = event->info;
37 double progress = event_running->progress; 39 printf("Animation is running! Current progress(%lf)\n", *progress);
38 printf("Animation is running! Current progress(%lf)\n", progress);
39} 40}
40 41
42EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
43 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
44 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
45)
46
41static void 47static void
42_start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 48_start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
43{ 49{
@@ -54,7 +60,7 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
54 efl_animation_start_delay_set(ad->show_anim, start_delay); 60 efl_animation_start_delay_set(ad->show_anim, start_delay);
55 61
56 //Create Animation Object from Animation 62 //Create Animation Object from Animation
57 efl_animation_player_animation_set(ad->anim_obj, ad->show_anim); 63 efl_canvas_object_animation_start(ad->button, ad->show_anim, 1.0, 0.0);
58 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0"); 64 efl_text_set(obj, "Start Alpha Animation from 1.0 to 0.0");
59 } 65 }
60 else 66 else
@@ -63,12 +69,9 @@ _start_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED
63 efl_animation_start_delay_set(ad->hide_anim, start_delay); 69 efl_animation_start_delay_set(ad->hide_anim, start_delay);
64 70
65 //Create Animation Object from Animation 71 //Create Animation Object from Animation
66 efl_animation_player_animation_set(ad->anim_obj, ad->hide_anim); 72 efl_canvas_object_animation_start(ad->button, ad->hide_anim, 1.0, 0.0);
67 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0"); 73 efl_text_set(obj, "Start Alpha Animation from 0.0 to 1.0");
68 } 74 }
69
70 //Let Animation Object start animation
71 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
72} 75}
73 76
74static void 77static void
@@ -96,6 +99,7 @@ test_efl_anim_start_delay(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
96 evas_object_resize(btn, 200, 200); 99 evas_object_resize(btn, 200, 200);
97 evas_object_move(btn, 100, 50); 100 evas_object_move(btn, 100, 50);
98 evas_object_show(btn); 101 evas_object_show(btn);
102 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
99 103
100 //Show Animation 104 //Show Animation
101 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win); 105 Efl_Canvas_Animation *show_anim = efl_add(EFL_CANVAS_ANIMATION_ALPHA_CLASS, win);
@@ -130,23 +134,12 @@ test_efl_anim_start_delay(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
130 evas_object_move(start_delay_spin, 100, 350); 134 evas_object_move(start_delay_spin, 100, 350);
131 evas_object_show(start_delay_spin); 135 evas_object_show(start_delay_spin);
132 136
133
134 //Initialize App Data 137 //Initialize App Data
135 ad->show_anim = show_anim; 138 ad->show_anim = show_anim;
136 ad->hide_anim = hide_anim; 139 ad->hide_anim = hide_anim;
137 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win,
138 efl_animation_player_target_set(efl_added, btn));
139
140 //Register callback called when animation starts
141 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
142 //Register callback called when animation ends
143 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, ad);
144 //Register callback called while animation is executed
145 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
146
147 ad->start_delay_spin = start_delay_spin; 140 ad->start_delay_spin = start_delay_spin;
148 ad->is_btn_visible = EINA_TRUE; 141 ad->is_btn_visible = EINA_TRUE;
149 142 ad->button = btn;
150 143
151 evas_object_resize(win, 400, 450); 144 evas_object_resize(win, 400, 450);
152 evas_object_show(win); 145 evas_object_show(win);
diff --git a/src/bin/elementary/test_efl_anim_translate.c b/src/bin/elementary/test_efl_anim_translate.c
index 5bbf1b2..7617be8 100644
--- a/src/bin/elementary/test_efl_anim_translate.c
+++ b/src/bin/elementary/test_efl_anim_translate.c
@@ -7,31 +7,38 @@ typedef struct _App_Data
7{ 7{
8 Efl_Canvas_Animation *translate_rb_anim; 8 Efl_Canvas_Animation *translate_rb_anim;
9 Efl_Canvas_Animation *translate_lt_anim; 9 Efl_Canvas_Animation *translate_lt_anim;
10 Efl_Canvas_Animation_Player *anim_obj; 10 Elm_Button *button;
11 11
12 Eina_Bool is_btn_translated; 12 Eina_Bool is_btn_translated;
13} App_Data; 13} App_Data;
14 14
15static void 15static void
16_anim_started_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 16_anim_changed_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
17{ 17{
18 printf("Animation has been started!\n"); 18 Eo *anim = event->info;
19}
20 19
21static void 20 if (anim)
22_anim_ended_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED) 21 {
23{ 22 printf("Animation has been started!\n");
24 printf("Animation has been ended!\n"); 23 }
24 else
25 {
26 printf("Animation has been ended!\n");
27 }
25} 28}
26 29
27static void 30static void
28_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event) 31_anim_running_cb(void *data EINA_UNUSED, const Efl_Event *event)
29{ 32{
30 Efl_Canvas_Animation_Player_Event_Running *event_running = event->info; 33 double *progress = event->info;
31 double progress = event_running->progress; 34 printf("Animation is running! Current progress(%lf)\n", *progress);
32 printf("Animation is running! Current progress(%lf)\n", progress);
33} 35}
34 36
37EFL_CALLBACKS_ARRAY_DEFINE(animation_stats_cb,
38 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _anim_changed_cb },
39 {EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _anim_running_cb },
40)
41
35static void 42static void
36_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED) 43_btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
37{ 44{
@@ -42,18 +49,15 @@ _btn_clicked_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
42 if (ad->is_btn_translated) 49 if (ad->is_btn_translated)
43 { 50 {
44 //Create Animation Object from Animation 51 //Create Animation Object from Animation
45 efl_animation_player_animation_set(ad->anim_obj, ad->translate_rb_anim); 52 efl_canvas_object_animation_start(ad->button, ad->translate_rb_anim, 1.0, 0.0);
46 efl_text_set(obj, "Start Translate Animation to left top"); 53 efl_text_set(obj, "Start Translate Animation to left top");
47 } 54 }
48 else 55 else
49 { 56 {
50 //Create Animation Object from Animation 57 //Create Animation Object from Animation
51 efl_animation_player_animation_set(ad->anim_obj, ad->translate_lt_anim); 58 efl_canvas_object_animation_start(ad->button, ad->translate_lt_anim, 1.0, 0.0);
52 efl_text_set(obj, "Start Translate Animation to right bottom"); 59 efl_text_set(obj, "Start Translate Animation to right bottom");
53 } 60 }
54
55 //Let Animation Object start animation
56 efl_player_playing_set(ad->anim_obj, EINA_TRUE);
57} 61}
58 62
59static void 63static void
@@ -81,6 +85,7 @@ test_efl_anim_translate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
81 evas_object_resize(btn, 150, 150); 85 evas_object_resize(btn, 150, 150);
82 evas_object_move(btn, 125, 100); 86 evas_object_move(btn, 125, 100);
83 evas_object_show(btn); 87 evas_object_show(btn);
88 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
84 89
85 //Translate Animation to right bottom relatively 90 //Translate Animation to right bottom relatively
86 Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win); 91 Efl_Canvas_Animation *translate_rb_anim = efl_add(EFL_CANVAS_ANIMATION_TRANSLATE_CLASS, win);
@@ -97,15 +102,7 @@ test_efl_anim_translate(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, vo
97 //Initialize App Data 102 //Initialize App Data
98 ad->translate_rb_anim = translate_rb_anim; 103 ad->translate_rb_anim = translate_rb_anim;
99 ad->translate_lt_anim = translate_lt_anim; 104 ad->translate_lt_anim = translate_lt_anim;
100 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 105 ad->button = btn;
101 efl_animation_player_target_set(efl_added, btn));
102 //Register callback called when animation starts
103 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
104 //Register callback called when animation ends
105 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
106 //Register callback called while animation is executed
107 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
108
109 ad->is_btn_translated = EINA_FALSE; 106 ad->is_btn_translated = EINA_FALSE;
110 107
111 //Button to start animation 108 //Button to start animation
@@ -139,6 +136,7 @@ test_efl_anim_translate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_U
139 evas_object_resize(btn, 150, 150); 136 evas_object_resize(btn, 150, 150);
140 evas_object_move(btn, 125, 100); 137 evas_object_move(btn, 125, 100);
141 evas_object_show(btn); 138 evas_object_show(btn);
139 efl_event_callback_array_add(btn, animation_stats_cb(), ad);
142 140
143 //Absolute coordinate (0, 0) for absolute translation 141 //Absolute coordinate (0, 0) for absolute translation
144 Evas_Object *abs_center = elm_button_add(win); 142 Evas_Object *abs_center = elm_button_add(win);
@@ -164,14 +162,7 @@ test_efl_anim_translate_absolute(void *data EINA_UNUSED, Evas_Object *obj EINA_U
164 ad->translate_rb_anim = translate_rb_anim; 162 ad->translate_rb_anim = translate_rb_anim;
165 ad->translate_lt_anim = translate_lt_anim; 163 ad->translate_lt_anim = translate_lt_anim;
166 ad->is_btn_translated = EINA_FALSE; 164 ad->is_btn_translated = EINA_FALSE;
167 ad->anim_obj = efl_add(EFL_CANVAS_ANIMATION_PLAYER_CLASS, win, 165 ad->button = btn;
168 efl_animation_player_target_set(efl_added, btn));
169 //Register callback called when animation starts
170 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_STARTED, _anim_started_cb, NULL);
171 //Register callback called when animation ends
172 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_ENDED, _anim_ended_cb, NULL);
173 //Register callback called while animation is executed
174 efl_event_callback_add(ad->anim_obj, EFL_ANIMATION_PLAYER_EVENT_RUNNING, _anim_running_cb, NULL);
175 166
176 //Button to start animation 167 //Button to start animation
177 Evas_Object *btn2 = elm_button_add(win); 168 Evas_Object *btn2 = elm_button_add(win);