49 lines
1.1 KiB
C#
49 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SHADE_Scripting.UI
|
|
{
|
|
|
|
public enum EASING_METHOD
|
|
{
|
|
EASE_IN_SINE,
|
|
EASE_OUT_SINE,
|
|
}
|
|
|
|
public static class EasingHelper
|
|
{
|
|
|
|
public static float EaseHelp(float value, EASING_METHOD method)
|
|
{
|
|
switch (method)
|
|
{
|
|
case EASING_METHOD.EASE_IN_SINE:
|
|
{
|
|
return EaseInSine(value);
|
|
}break;
|
|
case EASING_METHOD.EASE_OUT_SINE:
|
|
{
|
|
return EaseOutSine(value);
|
|
}break;
|
|
|
|
default:
|
|
return 0.0f;
|
|
}
|
|
}
|
|
|
|
private static float EaseInSine(float value)
|
|
{
|
|
return (float)(1.0f - Math.Cos((value * Math.PI) / 2.0f));
|
|
}
|
|
|
|
private static float EaseOutSine(float value)
|
|
{
|
|
return (float)(1.0f - Math.Sin(value * Math.PI) / 2.0f);
|
|
}
|
|
|
|
}
|
|
}
|