Easing2Curve: An editor window to create animation curve from easing functions
I’ve coded an EditorWindow to create an AnimationCurve using easing functions that define how much a value changes over time.
$# Introduction
There are many classic easing functions, such as: InQuad, OutElastic, InOutSin, and InOutBounce. All of these are functions that have a time
input parameter and a return value between 0 and 1.
For example, the easing function OutCirc
is coded like:
public float Calculate(float time)
{
return (float)Mathf.Sqrt((2 - time) * time);
}
In the Easing2Curve
editor window you can see 31 easing function availables:
- Linear
- InQuad, OutQuad, InOutQuad
- InCubic, OutCubic, InOutCubic
- InQuart, OutQuart, InOutQuart
- InQuint, OutQuint, InOutQuint
- InElastic, OutElastic, InOutElastic
- InSin, OutSin, InOutSin
- InExpo, OutExpo, InOutExpo
- InCirc, OutCirc, InOutCirc
- InBack, OutBack, InOutBack
- InBounce, OutBounce and InOutBounce.
In addition, you can add new easing functions just implementing the IEasing
interface.
Setup
To setup the Easing2Curve
just download this gist and unzip it on an Editor
folder inside your Unity project.
Using
You can open the window through the context menu on any AnimationCurve
property on Inspector
.
In the video below you can see how to use the Easing2Curve
: