modify
This commit is contained in:
parent
44b8b3a216
commit
4b720f8967
62
Runtime/Core/Animation/UISizeDelta.cs
Normal file
62
Runtime/Core/Animation/UISizeDelta.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
3
Runtime/Core/Animation/UISizeDelta.cs.meta
Normal file
3
Runtime/Core/Animation/UISizeDelta.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f371fc3375d34f16996a235b1b659f90
|
||||
timeCreated: 1741941042
|
Loading…
Reference in New Issue
Block a user