60 lines
1.1 KiB
C#
60 lines
1.1 KiB
C#
using UnityEngine;
|
|
|
|
public enum Acceleration
|
|
{
|
|
None = default,
|
|
EaseExpoIn,
|
|
EaseExpoOut,
|
|
EaseBounceIn,
|
|
EaseBounceOut,
|
|
|
|
// EaseBounceOut = None
|
|
//아직 정해지지 않은건 None표시
|
|
}
|
|
|
|
public static class EaseEffect
|
|
{
|
|
|
|
//가속도를 위한 함수...▼
|
|
|
|
|
|
public static float ExpoIn(float t)
|
|
{
|
|
return Mathf.Pow(2, 10 * (t - 1)) ;
|
|
}
|
|
|
|
public static float ExpoOut(float t)
|
|
{
|
|
return 1 - Mathf.Pow(2, -10 * t);
|
|
}
|
|
|
|
public static float BounceIn(float t)
|
|
{
|
|
return 1 - BounceOut(1 - t);
|
|
}
|
|
public static float BounceOut(float t)
|
|
{
|
|
if (t < (1 / 2.75f))
|
|
{
|
|
return 7.5625f * t * t;
|
|
}
|
|
else if (t < (2 / 2.75f))
|
|
{
|
|
t -= (1.5f / 2.75f);
|
|
return 7.5625f * t * t + 0.75f;
|
|
}
|
|
else if (t < (2.5f / 2.75f))
|
|
{
|
|
t -= (2.25f / 2.75f);
|
|
return 7.5625f * t * t + 0.9375f;
|
|
}
|
|
else
|
|
{
|
|
t -= (2.625f / 2.75f);
|
|
return 7.5625f * t * t + 0.984375f;
|
|
}
|
|
}
|
|
|
|
|
|
}
|