summaryrefslogtreecommitdiff
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
parent9eb0b28cc735326ab0079f49af0ae2668f9d5942 (diff)
downloadefl-4e8e1dc280a182448f698cf72a8df18f88342723.tar.gz
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.
-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,
_start(eo_obj, pd);
}
+static Eina_Bool
+_is_final_state(Efl_Canvas_Animation *anim, double progress)
+{
+ if (!anim) return EINA_FALSE;
+ if ((progress != 0.0) && (progress != 1.0)) return EINA_FALSE;
+
+ if (efl_animation_repeat_mode_get(anim) == EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE)
+ {
+ if (efl_animation_repeat_count_get(anim) & 1)
+ {
+ if (progress == 0.0)
+ return EINA_TRUE;
+ }
+ else
+ {
+ if (progress == 1.0)
+ return EINA_TRUE;
+ }
+ }
+ else
+ {
+ if (progress == 1.0)
+ return EINA_TRUE;
+ }
+
+ return EINA_FALSE;
+}
+
EOLIAN static void
_efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
Efl_Canvas_Animation_Player_Data *pd)
@@ -219,13 +247,19 @@ _efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
if (play)
{
efl_player_play_set(eo_obj, EINA_FALSE);
- if ((efl_animation_final_state_keep_get(anim)) &&
- (efl_animation_repeat_mode_get(anim) != EFL_CANVAS_ANIMATION_REPEAT_MODE_REVERSE) &&
- (!(efl_animation_repeat_count_get(anim) & 1)))
+ if (efl_animation_final_state_keep_get(anim))
{
- pd->progress = 1.0;
- efl_animation_apply(anim, pd->progress,
- efl_animation_player_target_get(eo_obj));
+ if (_is_final_state(anim, pd->progress))
+ {
+ /* Keep the final state only if efl_player_stop is called at
+ * the end of _animator_cb. */
+ efl_animation_apply(anim, pd->progress,
+ efl_animation_player_target_get(eo_obj));
+ }
+ else
+ {
+ pd->progress = 0.0;
+ }
}
else
{
@@ -235,7 +269,7 @@ _efl_canvas_animation_player_efl_player_stop(Eo *eo_obj,
}
else
{
- pd->progress = 0.0;
+ pd->progress = 0.0;
}
if (pd->auto_del) efl_del(eo_obj);