暂时存档
Timeline WindowAnim不止window能用
This commit is contained in:
45
Assets/Scripts/DynamicUI/WindowAnim.cs
Normal file
45
Assets/Scripts/DynamicUI/WindowAnim.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public static class WindowAnim
|
||||
{
|
||||
public static IEnumerator ShowPanel(GameObject gameObject)
|
||||
{
|
||||
AnimationCurve animationCurve = new AnimationCurve(
|
||||
new Keyframe(0, 0),
|
||||
new Keyframe(0.25f, 0.55f),
|
||||
new Keyframe(0.5f, 0.85f),
|
||||
new Keyframe(0.75f, 0.97f),
|
||||
new Keyframe(1, 1)
|
||||
);
|
||||
float timer = 0;
|
||||
while (timer <= 1)
|
||||
{
|
||||
gameObject.transform.localScale = Vector3.one * animationCurve.Evaluate(timer);
|
||||
timer += Time.deltaTime * 5f;
|
||||
yield return null;
|
||||
}
|
||||
gameObject.transform.localScale = Vector3.one;
|
||||
}
|
||||
public static IEnumerator HidePanel(GameObject gameObject, bool DestoryOrNot = false)
|
||||
{
|
||||
AnimationCurve animationCurve = new AnimationCurve(
|
||||
new Keyframe(0, 0),
|
||||
new Keyframe(0.25f, 0.55f),
|
||||
new Keyframe(0.5f, 0.85f),
|
||||
new Keyframe(0.75f, 0.97f),
|
||||
new Keyframe(1, 1)
|
||||
);
|
||||
float timer = 1;
|
||||
while (timer >= 0)
|
||||
{
|
||||
gameObject.transform.localScale = Vector3.one * animationCurve.Evaluate(timer);
|
||||
timer += Time.deltaTime * 5f;
|
||||
yield return null;
|
||||
}
|
||||
gameObject.transform.localScale = Vector3.zero;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user