Skip to content

Instantly share code, notes, and snippets.

@peppy
Created September 22, 2011 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save peppy/1235731 to your computer and use it in GitHub Desktop.
Save peppy/1235731 to your computer and use it in GitHub Desktop.
osu! easing functions
//used for easing = 1
internal static float easeInVal(float currTime, float start, float end, float duration)
{
return duration == 0 ? start : MathHelper.Lerp(end, start, (float) Math.Pow(1 - currTime/duration, 2));
}
//used for easing = 2
internal static float easeOutVal(float currTime, float start, float end, float duration)
{
return duration == 0 ? start : MathHelper.Lerp(start, end, (float) Math.Pow(currTime/duration, 2));
}
//used for easing = 0
internal static float easeNoneVal(float currTime, float start, float end, int duration)
{
return duration == 0 ? start : MathHelper.Lerp(start, end, currTime/duration);
}
// (yes i'm aware the function names are back-to-front >_>)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment