mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-21 07:50:16 +00:00
增加BaseChart.AnimationFadeOut()渐入动画,重构动画系统
This commit is contained in:
@@ -191,20 +191,10 @@ namespace XCharts
|
||||
get { return m_RuntimeMinValue; }
|
||||
internal set
|
||||
{
|
||||
if (value != m_RuntimeMinValue)
|
||||
{
|
||||
if (m_RuntimeMinValueFirstChanged)
|
||||
{
|
||||
m_RuntimeMinValueFirstChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RuntimeLastMinValue = m_RuntimeMinValue;
|
||||
m_RuntimeMinValueChanged = true;
|
||||
m_RuntimeMinValueUpdateTime = Time.time;
|
||||
}
|
||||
m_RuntimeMinValue = value;
|
||||
}
|
||||
m_RuntimeMinValue = value;
|
||||
m_RuntimeLastMinValue = value;
|
||||
m_RuntimeMinValueUpdateTime = Time.time;
|
||||
m_RuntimeMinValueChanged = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -216,20 +206,10 @@ namespace XCharts
|
||||
get { return m_RuntimeMaxValue; }
|
||||
internal set
|
||||
{
|
||||
if (value != m_RuntimeMaxValue)
|
||||
{
|
||||
if (m_RuntimeMaxValueFirstChanged)
|
||||
{
|
||||
m_RuntimeMaxValueFirstChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RuntimeLastMaxValue = m_RuntimeMaxValue;
|
||||
m_RuntimeMaxValueChanged = true;
|
||||
m_RuntimeMaxValueUpdateTime = Time.time;
|
||||
}
|
||||
m_RuntimeMaxValue = value;
|
||||
}
|
||||
m_RuntimeMaxValue = value;
|
||||
m_RuntimeLastMaxValue = value;
|
||||
m_RuntimeMaxValueUpdateTime = Time.time;
|
||||
m_RuntimeMaxValueChanged = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
@@ -708,6 +688,62 @@ namespace XCharts
|
||||
m_ValueRange = maxValue - minValue;
|
||||
}
|
||||
|
||||
internal void UpdateMinValue(float value, bool check)
|
||||
{
|
||||
if (value != m_RuntimeMaxValue)
|
||||
{
|
||||
if (check)
|
||||
{
|
||||
if (m_RuntimeMinValueFirstChanged)
|
||||
{
|
||||
m_RuntimeMinValueFirstChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RuntimeLastMinValue = m_RuntimeMinValue;
|
||||
m_RuntimeMinValueChanged = true;
|
||||
m_RuntimeMinValueUpdateTime = Time.time;
|
||||
}
|
||||
m_RuntimeMinValue = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RuntimeMinValue = value;
|
||||
m_RuntimeLastMinValue = value;
|
||||
m_RuntimeMinValueUpdateTime = Time.time;
|
||||
m_RuntimeMinValueChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpdateMaxValue(float value, bool check)
|
||||
{
|
||||
if (value != m_RuntimeMaxValue)
|
||||
{
|
||||
if (check)
|
||||
{
|
||||
if (m_RuntimeMaxValueFirstChanged)
|
||||
{
|
||||
m_RuntimeMaxValueFirstChanged = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RuntimeLastMaxValue = m_RuntimeMaxValue;
|
||||
m_RuntimeMaxValueChanged = true;
|
||||
m_RuntimeMaxValueUpdateTime = Time.time;
|
||||
}
|
||||
m_RuntimeMaxValue = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_RuntimeMaxValue = value;
|
||||
m_RuntimeLastMaxValue = value;
|
||||
m_RuntimeMaxValueUpdateTime = Time.time;
|
||||
m_RuntimeMaxValueChanged = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal float GetCurrMinValue(float duration)
|
||||
{
|
||||
if (m_RuntimeMinValue == 0 && m_RuntimeMaxValue == 0) return 0;
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public void ClearData()
|
||||
{
|
||||
AnimationStop();
|
||||
AnimationPause();
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
serie.ClearData();
|
||||
@@ -196,7 +196,7 @@ namespace XCharts
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable && serie.animation.updateAnimation)
|
||||
if (serie.animation.enable && serie.animation.dataChangeEnable)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@@ -257,7 +257,7 @@ namespace XCharts
|
||||
/// </summary>
|
||||
public void RemoveAll()
|
||||
{
|
||||
AnimationStop();
|
||||
AnimationPause();
|
||||
m_Series.Clear();
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace XCharts
|
||||
{
|
||||
serie.symbol.type = SerieSymbolType.None;
|
||||
}
|
||||
serie.animation.Reset();
|
||||
serie.animation.Restart();
|
||||
m_Series.Add(serie);
|
||||
return serie;
|
||||
}
|
||||
@@ -1006,32 +1006,54 @@ namespace XCharts
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开始初始动画
|
||||
/// 渐入动画
|
||||
/// </summary>
|
||||
public void AnimationStart()
|
||||
public void AnimationFadeIn()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable)
|
||||
{
|
||||
serie.animation.Start();
|
||||
serie.animation.FadeIn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 停止初始动画
|
||||
/// 渐出动画
|
||||
/// </summary>
|
||||
public void AnimationStop()
|
||||
public void AnimationFadeOut()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable) serie.animation.Stop();
|
||||
if (serie.animation.enable) serie.animation.FadeOut();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置初始动画
|
||||
/// 暂停动画
|
||||
/// </summary>
|
||||
public void AnimationPause()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable) serie.animation.Pause();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 继续动画
|
||||
/// </summary>
|
||||
public void AnimationResume()
|
||||
{
|
||||
foreach (var serie in m_Series)
|
||||
{
|
||||
if (serie.animation.enable) serie.animation.Resume();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 重置动画
|
||||
/// </summary>
|
||||
public void AnimationReset()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user