Sample game. Easing methods. Colors.

This commit is contained in:
Matt Thorson
2020-05-08 21:05:29 -07:00
parent 786b692a3f
commit 12ea2e43bc
18 changed files with 545 additions and 20 deletions

36
src/Static/Ease.bf Normal file
View File

@ -0,0 +1,36 @@
using System;
namespace Strawberry
{
static public class Ease
{
public delegate float Easer(float t);
static public float CubeIn(float t)
{
return t * t * t;
}
static public float CubeOut(float t)
{
return Invert(t, scope => CubeIn);
}
static public float CubeInOut(float t)
{
return Follow(t, scope => CubeIn, scope => CubeOut);
}
[Inline]
static public float Invert(float t, Easer easer)
{
return 1 - easer(1 - t);
}
[Inline]
static public float Follow(float t, Easer a, Easer b)
{
return (t <= 0.5f) ? a(t * 2) / 2 : b(t * 2 - 1) / 2 + 0.5f;
}
}
}