mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 23:40:10 +00:00
增加Animation的customFadeInDelay等自定义数据项延时和时长回调函数
This commit is contained in:
43
Examples/Runtime/Example03_ChartAnimation.cs
Normal file
43
Examples/Runtime/Example03_ChartAnimation.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Examples/Runtime/Example03_ChartAnimation.cs.meta
Normal file
11
Examples/Runtime/Example03_ChartAnimation.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6258ca3b055714eac92804f501011b53
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user