-
Notifications
You must be signed in to change notification settings - Fork 0
/
AnimationCurveSO.cs
37 lines (30 loc) · 1.06 KB
/
AnimationCurveSO.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using UnityEngine;
[CreateAssetMenu(menuName = "CustomSO/AnimationCurve", fileName = "AnimationCurveSO")]
public class AnimationCurveSO : ScriptableObject
{
public float Duration; // Set the duration in the Editor.
public AnimationCurve AnimationCurve; // Set the curve in the Editor.
}
// Examples:
//IEnumerator PlayAnimationCoroutine()
//{
// float time = 0;
// while (time < 1)
// {
// time += Time.deltaTime;
// transform.localScale = Vector3.one * animationCurve.Evaluate(time);
// yield return null;
// }
//}
//async UniTask SlideAnimation(Vector2 endPos)
//{
// float t = 0;
// Vector2 startPos = rectTransform.anchoredPosition;
// while (t < 1)
// {
// t += Time.deltaTime / navAnimationCurveData.Duration;
// rectTransform.anchoredPosition = Vector2.Lerp(startPos, endPos, navAnimationCurveData.AnimationCurve.Evaluate(t));
// await UniTask.Yield();
// }
// rectTransform.anchoredPosition = endPos; // Ensure the final position is accurate.
//}