summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2020-03-11 12:29:03 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2020-03-11 13:21:20 +0900
commit72da9ec8c6ef9e6081979c1caae3e4749d0a9965 (patch)
treee7cfacd265fc0bed3073f987c41479e5ae299f60
parent6fd2435c9eb2900106f347035757f2e584d097d4 (diff)
efl_ui_spotlight: Introduce forward and backward animationsdevs/jaehyun/animation_manager
forward_animation and backward_animation are introduced instead of push_setup, pop_setup, and jump_setup. forward_animation is started when active element is changed from lower index to higher index. This includes push() case. e.g. current active index is 0 and new active index becomes 1. backward_animation is started when active element is changed from higher index to lower index. This includes pop() case. e.g. current active index is 1 and new active index becomes 0.
-rw-r--r--src/bin/elementary/test_ui_spotlight.c29
-rw-r--r--src/lib/elementary/efl_ui_spotlight_animation_manager.c49
-rw-r--r--src/lib/elementary/efl_ui_spotlight_animation_manager.eo33
-rw-r--r--src/lib/elementary/efl_ui_spotlight_fade_manager.c18
4 files changed, 64 insertions, 65 deletions
diff --git a/src/bin/elementary/test_ui_spotlight.c b/src/bin/elementary/test_ui_spotlight.c
index 176f0a09cc..9877968f49 100644
--- a/src/bin/elementary/test_ui_spotlight.c
+++ b/src/bin/elementary/test_ui_spotlight.c
@@ -1136,7 +1136,8 @@ test_ui_spotlight_animation(void *data EINA_UNUSED,
1136 void *event_info EINA_UNUSED) 1136 void *event_info EINA_UNUSED)
1137{ 1137{
1138 Eo *win, *panes, *navi, *list, *layout, *spotlight, *view, *custom_animation_manager; 1138 Eo *win, *panes, *navi, *list, *layout, *spotlight, *view, *custom_animation_manager;
1139 Efl_Canvas_Animation *jump_animation, *push_animation, *pop_animation; 1139 Efl_Canvas_Animation *forward_in_animation, *forward_out_animation;
1140 Efl_Canvas_Animation *backward_in_animation, *backward_out_animation;
1140 Params *params = NULL; 1141 Params *params = NULL;
1141 char buf[PATH_MAX]; 1142 char buf[PATH_MAX];
1142 int i; 1143 int i;
@@ -1168,23 +1169,25 @@ test_ui_spotlight_animation(void *data EINA_UNUSED,
1168 efl_file_load(efl_added), 1169 efl_file_load(efl_added),
1169 efl_content_set(efl_part(panes, "second"), efl_added)); 1170 efl_content_set(efl_part(panes, "second"), efl_added));
1170 1171
1172 forward_in_animation = efl_new(EFL_CANVAS_TRANSLATE_ANIMATION_CLASS);
1173 efl_animation_translate_set(forward_in_animation, EINA_POSITION2D(0, 100), EINA_POSITION2D(0, 0));
1174 efl_animation_duration_set(forward_in_animation, 0.5);
1171 1175
1172 jump_animation = efl_new(EFL_CANVAS_ALPHA_ANIMATION_CLASS); 1176 forward_out_animation = efl_new(EFL_CANVAS_ALPHA_ANIMATION_CLASS);
1173 efl_animation_alpha_set(jump_animation, 0.0, 1.0); 1177 efl_animation_alpha_set(forward_out_animation, 1.0, 0.0);
1174 efl_animation_duration_set(jump_animation, 0.5); 1178 efl_animation_duration_set(forward_out_animation, 0.5);
1175 1179
1176 push_animation = efl_new(EFL_CANVAS_TRANSLATE_ANIMATION_CLASS); 1180 backward_in_animation = efl_new(EFL_CANVAS_ALPHA_ANIMATION_CLASS);
1177 efl_animation_translate_set(push_animation, EINA_POSITION2D(0, 100), EINA_POSITION2D(0, 0)); 1181 efl_animation_alpha_set(backward_in_animation, 0.0, 1.0);
1178 efl_animation_duration_set(push_animation, 0.5); 1182 efl_animation_duration_set(backward_in_animation, 0.5);
1179 1183
1180 pop_animation = efl_new(EFL_CANVAS_TRANSLATE_ANIMATION_CLASS); 1184 backward_out_animation = efl_new(EFL_CANVAS_TRANSLATE_ANIMATION_CLASS);
1181 efl_animation_translate_set(pop_animation, EINA_POSITION2D(0, -100), EINA_POSITION2D(0, 0)); 1185 efl_animation_translate_set(backward_out_animation, EINA_POSITION2D(0, 0), EINA_POSITION2D(0, 100));
1182 efl_animation_duration_set(pop_animation, 0.5); 1186 efl_animation_duration_set(backward_out_animation, 0.5);
1183 1187
1184 custom_animation_manager = efl_new(EFL_UI_SPOTLIGHT_ANIMATION_MANAGER_CLASS, 1188 custom_animation_manager = efl_new(EFL_UI_SPOTLIGHT_ANIMATION_MANAGER_CLASS,
1185 efl_ui_spotlight_manager_animation_push_setup_set(efl_added, push_animation), 1189 efl_ui_spotlight_manager_animation_forward_animation_set(efl_added, forward_in_animation, forward_out_animation),
1186 efl_ui_spotlight_manager_animation_pop_setup_set(efl_added, pop_animation), 1190 efl_ui_spotlight_manager_animation_backward_animation_set(efl_added, backward_in_animation, backward_out_animation));
1187 efl_ui_spotlight_manager_animation_jump_setup_set(efl_added, jump_animation, jump_animation));
1188 1191
1189 spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout, 1192 spotlight = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, layout,
1190 efl_ui_spotlight_manager_set(efl_added, custom_animation_manager), 1193 efl_ui_spotlight_manager_set(efl_added, custom_animation_manager),
diff --git a/src/lib/elementary/efl_ui_spotlight_animation_manager.c b/src/lib/elementary/efl_ui_spotlight_animation_manager.c
index dac8abd540..36ca34b2ec 100644
--- a/src/lib/elementary/efl_ui_spotlight_animation_manager.c
+++ b/src/lib/elementary/efl_ui_spotlight_animation_manager.c
@@ -8,7 +8,7 @@
8 8
9typedef struct { 9typedef struct {
10 Efl_Ui_Spotlight_Container * container; 10 Efl_Ui_Spotlight_Container * container;
11 Efl_Canvas_Animation *jump_anim[2], *push_anim, *pop_anim; 11 Efl_Canvas_Animation *forward_anim[2], *backward_anim[2];
12 Efl_Gfx_Entity *content[2]; 12 Efl_Gfx_Entity *content[2];
13 Efl_Gfx_Entity *clipper; 13 Efl_Gfx_Entity *clipper;
14 int ids[2]; //only used when in animation 14 int ids[2]; //only used when in animation
@@ -149,23 +149,28 @@ _efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_switch_to(Eo *obj,
149 Efl_Canvas_Animation *animation = NULL; 149 Efl_Canvas_Animation *animation = NULL;
150 pd->ids[i] = tmp[i]; 150 pd->ids[i] = tmp[i];
151 pd->content[i] = efl_pack_content_get(pd->container, pd->ids[i]); 151 pd->content[i] = efl_pack_content_get(pd->container, pd->ids[i]);
152 //when pushing, animate the *pushed in* content with the push animation 152 //when pushing, animate the *pushed* content with the forward animation
153 if (reason == EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_PUSH && i == 1) 153 if (reason == EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_PUSH)
154 animation = pd->push_anim; 154 animation = pd->forward_anim[i];
155 //when popping, animate the *popped in* content with the pop animation 155 //when popping, animate the *popped* content with the backward animation
156 else if (reason == EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_POP && i == 0) 156 else if (reason == EFL_UI_SPOTLIGHT_MANAGER_SWITCH_REASON_POP)
157 animation = pd->pop_anim; 157 animation = pd->backward_anim[i];
158 if (!animation) 158 if (!animation)
159 animation = pd->jump_anim[i]; 159 {
160 if (to > from)
161 animation = pd->forward_anim[i];
162 else
163 animation = pd->backward_anim[i];
164 }
160 if (pd->animation) 165 if (pd->animation)
161 efl_canvas_object_animation_start(pd->content[i], animation, -1.0+2.0*i, 0.0); 166 efl_canvas_object_animation_start(pd->content[i], animation, 1.0, 0.0);
162 efl_gfx_entity_visible_set(pd->content[i], EINA_TRUE); 167 efl_gfx_entity_visible_set(pd->content[i], EINA_TRUE);
163 } 168 }
164 if (pd->animation) 169 if (pd->animation)
165 { 170 {
166 efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _hide_object_cb, obj); 171 efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_CHANGED, _hide_object_cb, obj);
167 efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _running_cb, obj); 172 efl_event_callback_add(pd->content[0], EFL_CANVAS_OBJECT_ANIMATION_EVENT_ANIMATION_PROGRESS_UPDATED, _running_cb, obj);
168 efl_gfx_stack_above(pd->content[1], pd->content[0]); //Stack the "to content" above the "from content" 173 //efl_gfx_stack_above(pd->content[1], pd->content[0]); //Stack the "to content" above the "from content"
169 } 174 }
170 } 175 }
171 else 176 else
@@ -227,32 +232,32 @@ _efl_ui_spotlight_animation_manager_efl_ui_spotlight_manager_animated_transition
227} 232}
228 233
229EOLIAN static void 234EOLIAN static void
230_efl_ui_spotlight_animation_manager_push_setup_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *animation) 235_efl_ui_spotlight_animation_manager_forward_animation_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *in, Efl_Canvas_Animation *out)
231{ 236{
232 efl_replace(&pd->push_anim, animation); 237 EINA_SAFETY_ON_NULL_RETURN(out);
233} 238 EINA_SAFETY_ON_NULL_RETURN(in);
234 239
235EOLIAN static void 240 efl_replace(&pd->forward_anim[0], out);
236_efl_ui_spotlight_animation_manager_pop_setup_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *animation) 241 efl_replace(&pd->forward_anim[1], in);
237{
238 efl_replace(&pd->pop_anim, animation);
239} 242}
240 243
241EOLIAN static void 244EOLIAN static void
242_efl_ui_spotlight_animation_manager_jump_setup_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *in, Efl_Canvas_Animation *out) 245_efl_ui_spotlight_animation_manager_backward_animation_set(Eo *obj EINA_UNUSED, Efl_Ui_Spotlight_Animation_Manager_Data *pd, Efl_Canvas_Animation *in, Efl_Canvas_Animation *out)
243{ 246{
244 EINA_SAFETY_ON_NULL_RETURN(out); 247 EINA_SAFETY_ON_NULL_RETURN(out);
245 EINA_SAFETY_ON_NULL_RETURN(in); 248 EINA_SAFETY_ON_NULL_RETURN(in);
246 249
247 efl_replace(&pd->jump_anim[0], out); 250 efl_replace(&pd->backward_anim[0], out);
248 efl_replace(&pd->jump_anim[1], in); 251 efl_replace(&pd->backward_anim[1], in);
249} 252}
250 253
251EOLIAN static Efl_Object* 254EOLIAN static Efl_Object*
252_efl_ui_spotlight_animation_manager_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd) 255_efl_ui_spotlight_animation_manager_efl_object_finalize(Eo *obj, Efl_Ui_Spotlight_Animation_Manager_Data *pd)
253{ 256{
254 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->jump_anim[0], NULL); 257 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->forward_anim[0], NULL);
255 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->jump_anim[1], NULL); 258 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->forward_anim[1], NULL);
259 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->backward_anim[0], NULL);
260 EINA_SAFETY_ON_NULL_RETURN_VAL(pd->backward_anim[1], NULL);
256 261
257 return efl_finalize(efl_super(obj, MY_CLASS)); 262 return efl_finalize(efl_super(obj, MY_CLASS));
258} 263}
diff --git a/src/lib/elementary/efl_ui_spotlight_animation_manager.eo b/src/lib/elementary/efl_ui_spotlight_animation_manager.eo
index fe7539ee06..8314de488a 100644
--- a/src/lib/elementary/efl_ui_spotlight_animation_manager.eo
+++ b/src/lib/elementary/efl_ui_spotlight_animation_manager.eo
@@ -11,35 +11,19 @@ class @beta Efl.Ui.Spotlight.Animation_Manager extends Efl.Ui.Spotlight.Manager
11 ]] 11 ]]
12 c_prefix: efl_ui_spotlight_manager_animation; 12 c_prefix: efl_ui_spotlight_manager_animation;
13 methods { 13 methods {
14 @property push_setup{ 14 @property forward_animation {
15 [[Animation that is used to animate the $to argument of a switch_to request when the passed $reason is push. 15 [[Set the animation objects you want to play on going forward. (going from lower index page to higher index page)
16
17
18 If this animation is $null, the in animation of @.jump_setup will be taken instead.
19 ]] 16 ]]
20 values { 17 values {
21 animation : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]] 18 in : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]]
19 out : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference. Can be the same as $in.]]
22 } 20 }
23 set { } 21 set {
24 }
25 @property pop_setup{
26 [[Animation that is used to animate the $from argument of a switch_to request when the passed $reason is pop.
27
28 Note: this animations is always played backwards, see the class documentation for the reasoning.
29 22
30 If this animation is $null, the out animation of @.jump_setup will be taken instead.
31 ]]
32 values {
33 animation : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]]
34 } 23 }
35 set { }
36 } 24 }
37 @property jump_setup{ 25 @property backward_animation {
38 [[Set the animation objects you want to play on a jump in or jump out. 26 [[Set the animation objects you want to play on going backward. (going from higher index page to lower index page)
39
40 When a switch to request is issued, two arguments are getting animated. The $from object, and the $to objects. The $from object will be playing the out animation. The $pop object will be playing the in animation.
41
42 The out animation will always be played backwards, this is to support passing the same animation object to both parameters. (A fade animation will fade in the new object, and fade out the old object).
43 ]] 27 ]]
44 values { 28 values {
45 in : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]] 29 in : Efl.Canvas.Animation; [[The animation to play, the implementation will take an additional reference]]
@@ -51,7 +35,8 @@ class @beta Efl.Ui.Spotlight.Animation_Manager extends Efl.Ui.Spotlight.Manager
51 } 35 }
52 } 36 }
53 constructors { 37 constructors {
54 .jump_setup; 38 .forward_animation;
39 .backward_animation;
55 } 40 }
56 implements { 41 implements {
57 Efl.Ui.Spotlight.Manager.bind; 42 Efl.Ui.Spotlight.Manager.bind;
diff --git a/src/lib/elementary/efl_ui_spotlight_fade_manager.c b/src/lib/elementary/efl_ui_spotlight_fade_manager.c
index cb2fa5f0a4..1d6a349471 100644
--- a/src/lib/elementary/efl_ui_spotlight_fade_manager.c
+++ b/src/lib/elementary/efl_ui_spotlight_fade_manager.c
@@ -12,16 +12,22 @@ typedef struct {
12EOLIAN static Efl_Object* 12EOLIAN static Efl_Object*
13_efl_ui_spotlight_fade_manager_efl_object_constructor(Eo *obj, Efl_Ui_Spotlight_Fade_Manager_Data *pd EINA_UNUSED) 13_efl_ui_spotlight_fade_manager_efl_object_constructor(Eo *obj, Efl_Ui_Spotlight_Fade_Manager_Data *pd EINA_UNUSED)
14{ 14{
15 Efl_Canvas_Animation *animation; 15 Efl_Canvas_Animation *in_animation, *out_animation;
16 16
17 obj = efl_constructor(efl_super(obj, EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS)); 17 obj = efl_constructor(efl_super(obj, EFL_UI_SPOTLIGHT_FADE_MANAGER_CLASS));
18 18
19 animation = efl_add(EFL_CANVAS_ALPHA_ANIMATION_CLASS, obj); 19 in_animation = efl_add(EFL_CANVAS_ALPHA_ANIMATION_CLASS, obj);
20 efl_animation_alpha_set(animation, 0.0, 1.0); 20 efl_animation_alpha_set(in_animation, 0.0, 1.0);
21 efl_animation_duration_set(animation, 0.5); 21 efl_animation_duration_set(in_animation, 0.5);
22 22
23 efl_ui_spotlight_manager_animation_jump_setup_set(obj, animation, animation); 23 out_animation = efl_add(EFL_CANVAS_ALPHA_ANIMATION_CLASS, obj);
24 efl_unref(animation); 24 efl_animation_alpha_set(out_animation, 0.0, 1.0);
25 efl_animation_duration_set(out_animation, 0.5);
26
27 efl_ui_spotlight_manager_animation_forward_animation_set(obj, in_animation, out_animation);
28 efl_ui_spotlight_manager_animation_backward_animation_set(obj, in_animation, out_animation);
29 efl_unref(in_animation);
30 efl_unref(out_animation);
25 31
26 return obj; 32 return obj;
27} 33}