增加AnimationcustomFadeInDelay等自定义数据项延时和时长回调函数

This commit is contained in:
monitor1394
2020-06-09 06:57:37 +08:00
parent d3422ff4de
commit 2f9544b256
7 changed files with 181 additions and 42 deletions

View File

@@ -0,0 +1,43 @@
/******************************************/
/* */
/* Copyright (c) 2018 monitor1394 */
/* https://github.com/monitor1394 */
/* */
/******************************************/
using UnityEngine;
namespace XCharts.Examples
{
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class Example03_ChartAnimation : MonoBehaviour
{
BaseChart chart;
void Awake()
{
chart = gameObject.GetComponent<BaseChart>();
if (chart == null)
{
chart = gameObject.AddComponent<BarChart>();
}
var serie = chart.series.GetSerie(0);
serie.animation.enable = true;
//自定义每个数据项的渐入延时
serie.animation.customFadeInDelay = CustomFadeInDelay;
//自定义每个数据项的渐入时长
serie.animation.customFadeInDuration = CustomFadeInDuration;
}
float CustomFadeInDelay(int dataIndex)
{
return dataIndex * 1000;
}
float CustomFadeInDuration(int dataIndex)
{
return dataIndex * 1000 + 1000;
}
}
}