This class provides convenient access to several easing
functions and is coded in an easy to understand manner.
System Object NarayanaGames.Common NGEasingNamespace: NarayanaGames.CommonAssembly: Assembly-CSharp-firstpass (in Assembly-CSharp-firstpass.dll) Version: 0.0.0.0
public static class NGEasing
public static class NGEasing
If you
know how to use
Mathf.Lerp(),
you know how to work with these (only that the "linear" is not at all linear here ;-) ).
Personally, I like to draw the precise curve in the Unity editor
using
AnimationCurve.
And I've added a convenient API to use those just like Mathf.Lerp(),
which is inspired by
Mathfx from the UnifyCommunity Wiki.
However, there are a few cases where adding an AnimationCurve just
doesn't cut it (like when you want to convert linear property inspector values
from 0 to 1 that would result in only values between 0.7 and 0.9 having any
noticeable effect to have a noticeable effect in the whole range).
So for that purpose, I've added my own implementation of some
of the "usual suspect" easing functions:
The basic EaseIn/EaseOut/EaseInOut methods are inspired by
Robert
Penner's work - however, they are written from scratch to be more
readable, perfectly fit my needs and more versatile (but less
performant). The bouncing formulas were created using the
Easing Function Generator.
See also:
Stackoverflow: jQuery elastic easing equation