2020-06-09 06:57:37 +08:00
|
|
|
using UnityEngine;
|
2022-02-19 22:37:57 +08:00
|
|
|
using XCharts.Runtime;
|
2020-06-09 06:57:37 +08:00
|
|
|
|
2021-12-24 13:33:09 +08:00
|
|
|
namespace XCharts.Example
|
2020-06-09 06:57:37 +08:00
|
|
|
{
|
|
|
|
|
[DisallowMultipleComponent]
|
|
|
|
|
[ExecuteInEditMode]
|
|
|
|
|
public class Example03_ChartAnimation : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
BaseChart chart;
|
|
|
|
|
|
|
|
|
|
void Awake()
|
|
|
|
|
{
|
|
|
|
|
chart = gameObject.GetComponent<BaseChart>();
|
|
|
|
|
if (chart == null)
|
|
|
|
|
{
|
|
|
|
|
chart = gameObject.AddComponent<BarChart>();
|
2024-01-21 22:33:45 +08:00
|
|
|
chart.Init();
|
2020-06-09 06:57:37 +08:00
|
|
|
}
|
2021-11-23 13:20:07 +08:00
|
|
|
var serie = chart.GetSerie(0);
|
2020-06-09 06:57:37 +08:00
|
|
|
serie.animation.enable = true;
|
|
|
|
|
//自定义每个数据项的渐入延时
|
2023-07-14 08:14:00 +08:00
|
|
|
serie.animation.fadeIn.delayFunction = CustomFadeInDelay;
|
2020-06-09 06:57:37 +08:00
|
|
|
//自定义每个数据项的渐入时长
|
2023-07-14 08:14:00 +08:00
|
|
|
serie.animation.fadeIn.durationFunction = CustomFadeInDuration;
|
2020-06-09 06:57:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float CustomFadeInDelay(int dataIndex)
|
|
|
|
|
{
|
|
|
|
|
return dataIndex * 1000;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float CustomFadeInDuration(int dataIndex)
|
|
|
|
|
{
|
|
|
|
|
return dataIndex * 1000 + 1000;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|