From 4b720f89671ac7c69fd7c7b6e3559fd785a80981 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E6=80=9D=E6=B5=B7?= <1464576565@qq.com> Date: Fri, 14 Mar 2025 16:33:44 +0800 Subject: [PATCH] modify --- Runtime/Core/Animation/UISizeDelta.cs | 62 ++++++++++++++++++++++ Runtime/Core/Animation/UISizeDelta.cs.meta | 3 ++ 2 files changed, 65 insertions(+) create mode 100644 Runtime/Core/Animation/UISizeDelta.cs create mode 100644 Runtime/Core/Animation/UISizeDelta.cs.meta diff --git a/Runtime/Core/Animation/UISizeDelta.cs b/Runtime/Core/Animation/UISizeDelta.cs new file mode 100644 index 0000000..94d09d8 --- /dev/null +++ b/Runtime/Core/Animation/UISizeDelta.cs @@ -0,0 +1,62 @@ +using UnityEngine; + +namespace AlicizaX.AnimationFlow.Runtime +{ + [Category("RectTransform")] + public class UISizeDelta : ActionNode + { + public float duration = 1f; + public EaseType easyType; + public RectTransform target; + public bool setFrom; + public Vector2 from; + public Vector2 to; + protected Vector2 orgValue; + protected Vector2 enterValue; + + public override void OnInit() + { + orgValue = target.sizeDelta; + } + + public override void OnReset() + { + target.sizeDelta = orgValue; + } + + public override void OnEnter() + { + if (setFrom) + { + target.sizeDelta = from; + } + + enterValue = target.sizeDelta; + } + + public override void OnUpdate(float dt) + { + target.sizeDelta = Easing.Ease(easyType, enterValue, to, elapsedTime / duration); + } + + public override bool Valid() + { + return target != null && duration > 0; + } + + public override float Duration() + { + return duration; + } + + public override bool HasSubTitle() + { + return true; + } + + public override string SubTitle() + { + return target != null ? target.name : null; + } + } +} diff --git a/Runtime/Core/Animation/UISizeDelta.cs.meta b/Runtime/Core/Animation/UISizeDelta.cs.meta new file mode 100644 index 0000000..5737f0c --- /dev/null +++ b/Runtime/Core/Animation/UISizeDelta.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f371fc3375d34f16996a235b1b659f90 +timeCreated: 1741941042 \ No newline at end of file