This commit is contained in:
陈思海 2025-03-14 16:33:44 +08:00
parent 44b8b3a216
commit 4b720f8967
2 changed files with 65 additions and 0 deletions

View File

@ -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;
}
}
}

View File

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f371fc3375d34f16996a235b1b659f90
timeCreated: 1741941042