diff --git a/Runtime/Component/Axis/AxisAnimation.cs b/Runtime/Component/Axis/AxisAnimation.cs new file mode 100644 index 00000000..51f9ca12 --- /dev/null +++ b/Runtime/Component/Axis/AxisAnimation.cs @@ -0,0 +1,63 @@ +using UnityEngine; + +namespace XCharts.Runtime +{ + /// + /// animation style of axis. + /// ||坐标轴动画配置。 + /// + [System.Serializable] + [Since("v3.9.0")] + public class AxisAnimation : ChildComponent + { + [SerializeField] private bool m_Show = true; + [SerializeField] private float m_Duration; + [SerializeField] private bool m_UnscaledTime; + + /// + /// whether to enable animation. + /// ||是否开启动画。 + /// + public bool show + { + get { return m_Show; } + set { if (PropertyUtil.SetStruct(ref m_Show, value)) SetComponentDirty(); } + } + /// + /// the duration of animation (ms). When it is set to 0, the animation duration will be automatically calculated according to the serie. + /// ||动画时长(ms)。 默认设置为0时,会自动获取serie的动画时长。 + /// + public float duration + { + get { return m_Duration; } + set { if (PropertyUtil.SetStruct(ref m_Duration, value)) SetComponentDirty(); } + } + /// + /// Animation updates independently of Time.timeScale. + /// ||动画是否受TimeScaled的影响。默认为 false 受TimeScaled的影响。 + /// + public bool unscaledTime + { + get { return m_UnscaledTime; } + set { if (PropertyUtil.SetStruct(ref m_UnscaledTime, value)) SetComponentDirty(); } + } + + public AxisAnimation Clone() + { + var animation = new AxisAnimation + { + show = show, + duration = duration, + unscaledTime = unscaledTime + }; + return animation; + } + + public void Copy(AxisAnimation animation) + { + show = animation.show; + duration = animation.duration; + unscaledTime = animation.unscaledTime; + } + } +} \ No newline at end of file diff --git a/Runtime/Component/Axis/AxisAnimation.cs.meta b/Runtime/Component/Axis/AxisAnimation.cs.meta new file mode 100644 index 00000000..1d828275 --- /dev/null +++ b/Runtime/Component/Axis/AxisAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ecce90a24f1e64ce2affa51992d56ac4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: