From 5d8c4eaddf2104f70edc4e4b272495d6bd020d2f Mon Sep 17 00:00:00 2001 From: Ivan Kiselev Date: Fri, 4 Jul 2025 10:49:46 +0200 Subject: [PATCH] Stop animation timer when all animations are complete Previously, the Running flag was not set to false after all animations finished, causing the animation timer to continue ticking indefinitely and resulting in high CPU usage. --- SDUI/Animation/AnimationEngine.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SDUI/Animation/AnimationEngine.cs b/SDUI/Animation/AnimationEngine.cs index f9fe063..8531cec 100644 --- a/SDUI/Animation/AnimationEngine.cs +++ b/SDUI/Animation/AnimationEngine.cs @@ -224,8 +224,8 @@ private void CheckAnimationCompletion() var direction = animationDirections[i]; var progress = animationProgresses[i]; - if (direction == AnimationDirection.InOutIn || - direction == AnimationDirection.InOutRepeatingIn || + if (direction == AnimationDirection.InOutIn || + direction == AnimationDirection.InOutRepeatingIn || direction == AnimationDirection.InOutRepeatingOut) return; @@ -235,6 +235,7 @@ private void CheckAnimationCompletion() return; } + Running = false; OnAnimationFinished?.Invoke(this); }