AxisAnimation.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using UnityEngine;
  2. namespace XCharts.Runtime
  3. {
  4. /// <summary>
  5. /// animation style of axis.
  6. /// ||坐标轴动画配置。
  7. /// </summary>
  8. [System.Serializable]
  9. [Since("v3.9.0")]
  10. public class AxisAnimation : ChildComponent
  11. {
  12. [SerializeField] private bool m_Show = true;
  13. [SerializeField] private float m_Duration;
  14. [SerializeField] private bool m_UnscaledTime;
  15. /// <summary>
  16. /// whether to enable animation.
  17. /// ||是否开启动画。
  18. /// </summary>
  19. public bool show
  20. {
  21. get { return m_Show; }
  22. set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); }
  23. }
  24. /// <summary>
  25. /// the duration of animation (ms). When it is set to 0, the animation duration will be automatically calculated according to the serie.
  26. /// ||动画时长(ms)。 默认设置为0时,会自动获取serie的动画时长。
  27. /// </summary>
  28. public float duration
  29. {
  30. get { return m_Duration; }
  31. set { if (PropertyUtil.SetStruct(ref m_Duration, value)) SetComponentDirty(); }
  32. }
  33. /// <summary>
  34. /// Animation updates independently of Time.timeScale.
  35. /// ||动画是否受TimeScaled的影响。默认为 false 受TimeScaled的影响。
  36. /// </summary>
  37. public bool unscaledTime
  38. {
  39. get { return m_UnscaledTime; }
  40. set { if (PropertyUtil.SetStruct(ref m_UnscaledTime, value)) SetComponentDirty(); }
  41. }
  42. public AxisAnimation Clone()
  43. {
  44. var animation = new AxisAnimation
  45. {
  46. show = show,
  47. duration = duration,
  48. unscaledTime = unscaledTime
  49. };
  50. return animation;
  51. }
  52. public void Copy(AxisAnimation animation)
  53. {
  54. show = animation.show;
  55. duration = animation.duration;
  56. unscaledTime = animation.unscaledTime;
  57. }
  58. }
  59. }