From 1f970cbb36805246d695e14fd30243f7a4b2493b Mon Sep 17 00:00:00 2001 From: monitor1394 Date: Fri, 24 Nov 2023 08:29:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0`Axis`=E7=9A=84`Animation`?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E5=8A=A8=E7=94=BB=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Component/Axis/AxisAnimation.cs | 63 ++++++++++++++++++++ Runtime/Component/Axis/AxisAnimation.cs.meta | 11 ++++ 2 files changed, 74 insertions(+) create mode 100644 Runtime/Component/Axis/AxisAnimation.cs create mode 100644 Runtime/Component/Axis/AxisAnimation.cs.meta 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: