From eb196a237f25c28089bef74b7ddd00f1a99fa2a2 Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Sat, 2 Sep 2023 10:43:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96Animation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Component/Animation/AnimationInfo.cs | 15 ++++++++++++--- Runtime/Component/Interaction/InteractData.cs | 16 ++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/Runtime/Component/Animation/AnimationInfo.cs b/Runtime/Component/Animation/AnimationInfo.cs index 6903eaf5..5a40df46 100644 --- a/Runtime/Component/Animation/AnimationInfo.cs +++ b/Runtime/Component/Animation/AnimationInfo.cs @@ -73,7 +73,15 @@ namespace XCharts.Runtime context.pause = false; context.end = false; context.startTime = 0; + context.currProgress = 0; + context.destProgress = 0; + context.totalProgress = 0; + context.sizeProgress = 0; + context.currPointIndex = 0; + context.currPoint = Vector3.zero; + context.destPoint = Vector3.zero; context.dataCurrProgress.Clear(); + context.dataDestProgress.Clear(); } /// @@ -84,8 +92,7 @@ namespace XCharts.Runtime public void Start(bool reset = true) { if (!enable) return; - if (context.start) return; - if (context.pause) + if (context.start) { context.pause = false; return; @@ -187,7 +194,9 @@ namespace XCharts.Runtime if (!context.start) return true; if (context.end) return true; if (context.pause) return false; - return context.currProgress == context.destProgress; + if (!context.init) return false; + return m_Reverse ? context.currProgress <= context.destProgress + : context.currProgress >= context.destProgress; } /// diff --git a/Runtime/Component/Interaction/InteractData.cs b/Runtime/Component/Interaction/InteractData.cs index b14cd98d..23f210df 100644 --- a/Runtime/Component/Interaction/InteractData.cs +++ b/Runtime/Component/Interaction/InteractData.cs @@ -5,14 +5,14 @@ namespace XCharts.Runtime public class InteractData { private float m_PreviousValue = 0; - private float m_CurrentValue = 0; - private float m_TargetValue = 0; - private Vector3 m_PreviousPosition; - private Vector3 m_TargetPosition; - private Color32 m_PreviousColor; - private Color32 m_TargetColor; - private Color32 m_PreviousToColor; - private Color32 m_TargetToColor; + private float m_CurrentValue = float.NaN; + private float m_TargetValue = float.NaN; + private Vector3 m_PreviousPosition = Vector3.one; + private Vector3 m_TargetPosition = Vector3.one; + private Color32 m_PreviousColor = ColorUtil.clearColor32; + private Color32 m_TargetColor = ColorUtil.clearColor32; + private Color32 m_PreviousToColor = ColorUtil.clearColor32; + private Color32 m_TargetToColor = ColorUtil.clearColor32; private float m_UpdateTime = 0; private bool m_UpdateFlag = false; private bool m_ValueEnable = false;