增加AnimationReset()重置初始化动画接口

This commit is contained in:
monitor1394
2019-09-26 19:10:56 +08:00
parent 2c0b86f897
commit 82cc23548d
4 changed files with 28 additions and 1 deletions

View File

@@ -831,6 +831,17 @@ namespace XCharts
}
}
/// <summary>
/// 重置初始动画
/// </summary>
public void AnimationReset()
{
foreach (var serie in m_Series)
{
if (serie.animation.enable) serie.animation.Reset();
}
}
/// <summary>
/// 从json中解析数据
/// </summary>

View File

@@ -100,6 +100,12 @@ namespace XCharts
m_IsEnd = true;
}
public void Reset()
{
Stop();
Start();
}
public void InitProgress(int data, float curr, float dest)
{
if (!m_Inited && !m_IsEnd)

View File

@@ -451,5 +451,16 @@ namespace XCharts
m_CheckAnimation = false;
m_Series.AnimationStop();
}
/// <summary>
/// Reset animation to play.
/// 重置初始动画,重新播放。
/// </summary>
public void AnimationReset()
{
m_CheckAnimation = false;
m_Series.AnimationReset();
RefreshChart();
}
}
}

View File

@@ -238,7 +238,6 @@ namespace XCharts
{
float duration = serie.animation.duration > 0 ? (float)serie.animation.duration / 1000 : 1;
float speed = totalDetailProgress / duration;
Debug.LogError("speed:"+speed);
float symbolSpeed = serie.symbol.size / duration;
serie.animation.CheckProgress(Time.deltaTime * speed);
serie.animation.CheckSymbol(Time.deltaTime * symbolSpeed, serie.symbol.size);