No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Example03_ChartAnimation.cs 1001B

12345678910111213141516171819202122232425262728293031323334353637
  1. using UnityEngine;
  2. using XCharts.Runtime;
  3. namespace XCharts.Example
  4. {
  5. [DisallowMultipleComponent]
  6. [ExecuteInEditMode]
  7. public class Example03_ChartAnimation : MonoBehaviour
  8. {
  9. BaseChart chart;
  10. void Awake()
  11. {
  12. chart = gameObject.GetComponent<BaseChart>();
  13. if (chart == null)
  14. {
  15. chart = gameObject.AddComponent<BarChart>();
  16. }
  17. var serie = chart.GetSerie(0);
  18. serie.animation.enable = true;
  19. //自定义每个数据项的渐入延时
  20. serie.animation.fadeInDelayFunction = CustomFadeInDelay;
  21. //自定义每个数据项的渐入时长
  22. serie.animation.fadeInDurationFunction = CustomFadeInDuration;
  23. }
  24. float CustomFadeInDelay(int dataIndex)
  25. {
  26. return dataIndex * 1000;
  27. }
  28. float CustomFadeInDuration(int dataIndex)
  29. {
  30. return dataIndex * 1000 + 1000;
  31. }
  32. }
  33. }