summaryrefslogtreecommitdiff
path: root/src/lib/evas/canvas/efl_canvas_animation_player.c
diff options
context:
space:
mode:
authorJaehyun Cho <jae_hyun.cho@samsung.com>2019-06-04 21:49:08 +0900
committerJaehyun Cho <jae_hyun.cho@samsung.com>2019-06-04 21:57:00 +0900
commit4e8e1dc280a182448f698cf72a8df18f88342723 (patch)
tree56eebb532d9f51e0f8b5e8a0eb36b485fea8da13 /src/lib/evas/canvas/efl_canvas_animation_player.c
parent9eb0b28cc735326ab0079f49af0ae2668f9d5942 (diff)
efl_canvas_animation: fix final_state_keep logic
Previously, final_state_keep did not work correctly with animation repeat. e.g. repeat mode is restart and repeat count is 1, then final_state_keep did not work. Now, final_state_keep logic has been fixed to work correctly.
Diffstat (limited to '')
-rw-r--r--src/lib/evas/canvas/efl_canvas_animation_player.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/src/lib/evas/canvas/efl_canvas_animation_player.c b/src/lib/evas/canvas/efl_canvas_animation_player.c
index edb4d66c53..8466067a12 100644
--- a/src/lib/evas/canvas/efl_canvas_animation_player.c
+++ b/src/lib/evas/canvas/efl_canvas_animation_player.c
@@ -206,6 +206,34 @@ _efl_canvas_animation_player_efl_player_start(Eo *eo_obj,
206 _start(eo_obj, pd); 206 _start(eo_obj, pd);
207} 207}
208 208
209static Eina_Bool
210_is_final_state(Efl_Canvas_Animation *anim, double progress)
211{
212 if (!anim) return EINA_FALSE;
213 if ((progress != 0.0) && (progress != 1.0)) return EINA_FALSE;
214
215 if (efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
216 {
217 if (efl_animation_repeat_count_get(anim) & 1)
218 {
219 if (progress == 0.0)
220 return EINA_TRUE;
221 }
222 else
223 {
224 if (progress == 1.0)
225 return EINA_TRUE;
226 }
227 }
228 else
229 {
230 if (progress == 1.0)
231 return EINA_TRUE;
232 }
233
234 return EINA_FALSE;
235}
236
209EOLIAN static void 237EOLIAN static void
210_efl_canvas_animation_player_efl_player_stop(Eo *eo_obj, 238_efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
211 Efl_Canvas_Animation_Player_Data *pd) 239 Efl_Canvas_Animation_Player_Data *pd)
@@ -219,13 +247,19 @@ _efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
219 if (play) 247 if (play)
220 { 248 {
221 efl_player_play_set(eo_obj, EINA_FALSE); 249 efl_player_play_set(eo_obj, EINA_FALSE);
222 if ((efl_animation_final_state_keep_get(anim)) && 250 if (efl_animation_final_state_keep_get(anim))
223 (efl_animation_repeat_mode_get(anim) != EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) &&
224 (!(efl_animation_repeat_count_get(anim) & 1)))
225 { 251 {
226 pd->progress = 1.0; 252 if (_is_final_state(anim, pd->progress))
227 efl_animation_apply(anim, pd->progress, 253 {
228 efl_animation_player_target_get(eo_obj)); 254 /* Keep the final state only if efl_player_stop is called at
255 * the end of _animator_cb. */
256 efl_animation_apply(anim, pd->progress,
257 efl_animation_player_target_get(eo_obj));
258 }
259 else
260 {
261 pd->progress = 0.0;
262 }
229 } 263 }
230 else 264 else
231 { 265 {
@@ -235,7 +269,7 @@ _efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
235 } 269 }
236 else 270 else
237 { 271 {
238 pd->progress = 0.0; 272 pd->progress = 0.0;
239 } 273 }
240 274
241 if (pd->auto_del) efl_del(eo_obj); 275 if (pd->auto_del) efl_del(eo_obj);