Files
ichni_Official/Assets/Scripts/Game/Base/EaseCurve/CustomCurvePresets.cs
SoulliesOfficial d4e860fa16 initial
2025-06-03 02:42:28 -04:00

28 lines
932 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Ichni
{
/// <summary>
/// 自定义曲线预设
/// </summary>
public static class CustomCurvePresets
{
/// <summary>
/// 抛物线曲线,在中间达到最大值,两端为起始值
/// </summary>
/// <param name="totalTime">总时间</param>
/// <param name="startValue">起始(和结束)值</param>
/// <param name="peakValue">中点最大值</param>
public static AnimationCurve Parabolic(float totalTime, float startValue, float peakValue)
{
Keyframe[] keys = new Keyframe[3];
keys[0] = new Keyframe(0, startValue, 0, 0);
keys[1] = new Keyframe(totalTime / 2, peakValue, 0, 0);
keys[2] = new Keyframe(totalTime, startValue, 0, 0);
return new AnimationCurve(keys);
}
}
}