mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-14 20:00:09 +00:00
优化Animation的新增动画表现
This commit is contained in:
@@ -79,6 +79,7 @@ slug: /changelog
|
||||
|
||||
## master
|
||||
|
||||
* (2025.03.06) 优化`Animation`的新增动画表现
|
||||
* (2025.03.04) 修复`Treemap`的`label`显示异常的问题
|
||||
* (2025.03.02) 增加`Tooltip`的`columnGapWidths`参数设置列文本间隙距离
|
||||
* (2025.03.01) 优化`Comment`的组件刷新
|
||||
|
||||
@@ -147,6 +147,7 @@ namespace XCharts.Runtime
|
||||
{
|
||||
if (!enable) return;
|
||||
if (!context.start || context.end) return;
|
||||
context.init = false;
|
||||
context.start = false;
|
||||
context.end = true;
|
||||
context.currPointIndex = context.destPointIndex;
|
||||
@@ -168,20 +169,19 @@ namespace XCharts.Runtime
|
||||
public bool Init(float curr, float dest, int totalPointIndex)
|
||||
{
|
||||
if (!enable || !context.start) return false;
|
||||
if (context.init || context.end) return false;
|
||||
context.init = true;
|
||||
context.totalProgress = dest - curr;
|
||||
context.destPointIndex = totalPointIndex;
|
||||
if (reverse)
|
||||
{
|
||||
context.currProgress = dest;
|
||||
if (!context.init) context.currProgress = dest;
|
||||
context.destProgress = curr;
|
||||
}
|
||||
else
|
||||
{
|
||||
context.currProgress = curr;
|
||||
if (!context.init) context.currProgress = curr;
|
||||
context.destProgress = dest;
|
||||
}
|
||||
context.init = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -306,7 +306,7 @@ namespace XCharts.Runtime
|
||||
startIndex = anim.context.currPointIndex == paths.Count - 1 ?
|
||||
paths.Count - 2 :
|
||||
anim.context.currPointIndex;
|
||||
if (startIndex < 0 || startIndex > paths.Count - 2) startIndex = 0;
|
||||
if (startIndex < 0 || startIndex >= paths.Count - 1) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -336,9 +336,12 @@ namespace XCharts.Runtime
|
||||
{
|
||||
return;
|
||||
}
|
||||
anim.context.currPoint = sp;
|
||||
anim.context.destPoint = ep;
|
||||
anim.Init(currDetailProgress, totalDetailProgress, paths.Count - 1);
|
||||
|
||||
if (anim.Init(currDetailProgress, totalDetailProgress, paths.Count - 1))
|
||||
{
|
||||
anim.context.currPoint = sp;
|
||||
anim.context.destPoint = ep;
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsEnd()
|
||||
@@ -362,12 +365,23 @@ namespace XCharts.Runtime
|
||||
return true;
|
||||
var animation = activedAnimation;
|
||||
if (animation != null && animation.context.end)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
if (IsSerieAnimation())
|
||||
{
|
||||
if (m_FadeOut.context.start) return m_FadeOut.context.currProgress <= m_FadeOut.context.destProgress;
|
||||
else if (m_Addition.context.start) return m_Addition.context.currProgress >= m_Addition.context.destProgress;
|
||||
else return m_FadeIn.context.currProgress >= m_FadeIn.context.destProgress;
|
||||
if (m_FadeOut.context.start)
|
||||
{
|
||||
return m_FadeOut.context.currProgress <= m_FadeOut.context.destProgress;
|
||||
}
|
||||
else if (m_Addition.context.start)
|
||||
{
|
||||
return m_Addition.context.currProgress >= m_Addition.context.destProgress;
|
||||
}
|
||||
else
|
||||
{
|
||||
return m_FadeIn.context.currProgress >= m_FadeIn.context.destProgress;
|
||||
}
|
||||
}
|
||||
else if (IsDataAnimation())
|
||||
{
|
||||
|
||||
@@ -2029,6 +2029,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public void AnimationFadeIn()
|
||||
{
|
||||
if (dataCount <= 0) return;
|
||||
ResetInteract();
|
||||
if (animation.enable) animation.FadeIn();
|
||||
SetVerticesDirty();
|
||||
@@ -2039,6 +2040,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public void AnimationFadeOut()
|
||||
{
|
||||
if (dataCount <= 0) return;
|
||||
ResetInteract();
|
||||
if (animation.enable) animation.FadeOut();
|
||||
SetVerticesDirty();
|
||||
@@ -2049,6 +2051,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public void AnimationPause()
|
||||
{
|
||||
if (dataCount <= 0) return;
|
||||
if (animation.enable) animation.Pause();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
@@ -2058,6 +2061,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public void AnimationResume()
|
||||
{
|
||||
if (dataCount <= 0) return;
|
||||
if (animation.enable) animation.Resume();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
@@ -2067,6 +2071,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public void AnimationReset()
|
||||
{
|
||||
if (dataCount <= 0) return;
|
||||
if (animation.enable) animation.Reset();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
@@ -2076,6 +2081,7 @@ namespace XCharts.Runtime
|
||||
/// </summary>
|
||||
public void AnimationRestart()
|
||||
{
|
||||
if (dataCount <= 0) return;
|
||||
if (animation.enable) animation.Restart();
|
||||
SetVerticesDirty();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user