ORK Framework  2.25.2
API Documentation
ORKFramework.Interpolate Class Reference

Static Public Member Functions

static float Ease (Function ease, float start, float distance, float elapsedTime, float duration)
 
static Vector2 Ease (Function ease, Vector2 start, Vector2 distance, float elapsedTime, float duration)
 
static Vector3 Ease (Function ease, Vector3 start, Vector3 distance, float elapsedTime, float duration)
 
static Quaternion Ease (Function ease, Quaternion begin, Quaternion end, float elapsedTime, float duration)
 
static Function Ease (EaseType type)
 
static Vector3 Identity (Vector3 v)
 
static Vector3 TransformDotPosition (Transform t)
 
static float Linear (float start, float distance, float elapsedTime, float duration)
 
static float EaseInQuad (float start, float distance, float elapsedTime, float duration)
 
static float EaseOutQuad (float start, float distance, float elapsedTime, float duration)
 
static float EaseInOutQuad (float start, float distance, float elapsedTime, float duration)
 
static float EaseInCubic (float start, float distance, float elapsedTime, float duration)
 
static float EaseOutCubic (float start, float distance, float elapsedTime, float duration)
 
static float EaseInOutCubic (float start, float distance, float elapsedTime, float duration)
 
static float EaseInQuart (float start, float distance, float elapsedTime, float duration)
 
static float EaseOutQuart (float start, float distance, float elapsedTime, float duration)
 
static float EaseInOutQuart (float start, float distance, float elapsedTime, float duration)
 
static float EaseInQuint (float start, float distance, float elapsedTime, float duration)
 
static float EaseOutQuint (float start, float distance, float elapsedTime, float duration)
 
static float EaseInOutQuint (float start, float distance, float elapsedTime, float duration)
 
static float EaseInSine (float start, float distance, float elapsedTime, float duration)
 
static float EaseOutSine (float start, float distance, float elapsedTime, float duration)
 
static float EaseInOutSine (float start, float distance, float elapsedTime, float duration)
 
static float EaseInExpo (float start, float distance, float elapsedTime, float duration)
 
static float EaseOutExpo (float start, float distance, float elapsedTime, float duration)
 
static float EaseInOutExpo (float start, float distance, float elapsedTime, float duration)
 
static float EaseInCirc (float start, float distance, float elapsedTime, float duration)
 
static float EaseOutCirc (float start, float distance, float elapsedTime, float duration)
 
static float EaseInOutCirc (float start, float distance, float elapsedTime, float duration)
 

Member Function Documentation

◆ Ease() [1/5]

static float ORKFramework.Interpolate.Ease ( Function  ease,
float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

Interpolation utility functions: easing, bezier, and catmull-rom. Consider using Unity's Animation curve editor and AnimationCurve class before scripting the desired behaviour using this utility.

Interpolation functionality available at different levels of abstraction. Low level access via individual easing functions (ex. EaseInOutCirc), Bezier(), and CatmullRom(). High level access using sequence generators, NewEase(), NewBezier(), and NewCatmullRom().

Sequence generators are typically used as follows:

var sequence = Interpolate.New[Ease|Bezier|CatmulRom](configuration); for (var newPoint in sequence) { transform.position = newPoint; yield; }

Or:

var sequence = Interpolate.New[Ease|Bezier|CatmulRom](configuration); function Update() { if (sequence.MoveNext()) { transform.position = sequence.Current; } }

The low level functions work similarly to Unity's built in Lerp and it is up to you to track and pass in elapsedTime and duration on every call. The functions take this form (or the logical equivalent for Bezier() and CatmullRom()).

transform.position = ease(start, distance, elapsedTime, duration);

For convenience in configuration you can use the Ease(EaseType) function to look up a concrete easing function:

var easeType : EaseType; // set using Unity's property inspector var Function ease; // easing of a particular EaseType function Awake() { ease = Interpolate.Ease(easeType); }

Author
Fernando Zapata (ferna.nosp@m.ndo@.nosp@m.cpudr.nosp@m.eams.nosp@m..com)float interpolation using given easing method.

◆ Ease() [2/5]

static Vector2 ORKFramework.Interpolate.Ease ( Function  ease,
Vector2  start,
Vector2  distance,
float  elapsedTime,
float  duration 
)
static

Vector2 interpolation using given easing method. Easing is done independently on all three vector axis.

◆ Ease() [3/5]

static Vector3 ORKFramework.Interpolate.Ease ( Function  ease,
Vector3  start,
Vector3  distance,
float  elapsedTime,
float  duration 
)
static

Vector3 interpolation using given easing method. Easing is done independently on all three vector axis.

◆ Ease() [4/5]

static Quaternion ORKFramework.Interpolate.Ease ( Function  ease,
Quaternion  begin,
Quaternion  end,
float  elapsedTime,
float  duration 
)
static

Quaternion interpolation using given easing method. Easing is done independently on all axis.

◆ Ease() [5/5]

static Function ORKFramework.Interpolate.Ease ( EaseType  type)
static

Returns the static method that implements the given easing type for scalars. Use this method to easily switch between easing interpolation types.

All easing methods clamp elapsedTime so that it is always <= duration.

var ease = Interpolate.Ease(EaseType.EaseInQuad); i = ease(start, distance, elapsedTime, duration);

◆ EaseInCirc()

static float ORKFramework.Interpolate.EaseInCirc ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

circular easing in - accelerating from zero velocity

◆ EaseInCubic()

static float ORKFramework.Interpolate.EaseInCubic ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

cubic easing in - accelerating from zero velocity

◆ EaseInExpo()

static float ORKFramework.Interpolate.EaseInExpo ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

exponential easing in - accelerating from zero velocity

◆ EaseInOutCirc()

static float ORKFramework.Interpolate.EaseInOutCirc ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

circular easing in/out - acceleration until halfway, then deceleration

◆ EaseInOutCubic()

static float ORKFramework.Interpolate.EaseInOutCubic ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

cubic easing in/out - acceleration until halfway, then deceleration

◆ EaseInOutExpo()

static float ORKFramework.Interpolate.EaseInOutExpo ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

exponential easing in/out - accelerating until halfway, then decelerating

◆ EaseInOutQuad()

static float ORKFramework.Interpolate.EaseInOutQuad ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quadratic easing in/out - acceleration until halfway, then deceleration

◆ EaseInOutQuart()

static float ORKFramework.Interpolate.EaseInOutQuart ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quartic easing in/out - acceleration until halfway, then deceleration

◆ EaseInOutQuint()

static float ORKFramework.Interpolate.EaseInOutQuint ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quintic easing in/out - acceleration until halfway, then deceleration

◆ EaseInOutSine()

static float ORKFramework.Interpolate.EaseInOutSine ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

sinusoidal easing in/out - accelerating until halfway, then decelerating

◆ EaseInQuad()

static float ORKFramework.Interpolate.EaseInQuad ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quadratic easing in - accelerating from zero velocity

◆ EaseInQuart()

static float ORKFramework.Interpolate.EaseInQuart ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quartic easing in - accelerating from zero velocity

◆ EaseInQuint()

static float ORKFramework.Interpolate.EaseInQuint ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quintic easing in - accelerating from zero velocity

◆ EaseInSine()

static float ORKFramework.Interpolate.EaseInSine ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

sinusoidal easing in - accelerating from zero velocity

◆ EaseOutCirc()

static float ORKFramework.Interpolate.EaseOutCirc ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

circular easing out - decelerating to zero velocity

◆ EaseOutCubic()

static float ORKFramework.Interpolate.EaseOutCubic ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

cubic easing out - decelerating to zero velocity

◆ EaseOutExpo()

static float ORKFramework.Interpolate.EaseOutExpo ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

exponential easing out - decelerating to zero velocity

◆ EaseOutQuad()

static float ORKFramework.Interpolate.EaseOutQuad ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quadratic easing out - decelerating to zero velocity

◆ EaseOutQuart()

static float ORKFramework.Interpolate.EaseOutQuart ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quartic easing out - decelerating to zero velocity

◆ EaseOutQuint()

static float ORKFramework.Interpolate.EaseOutQuint ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

quintic easing out - decelerating to zero velocity

◆ EaseOutSine()

static float ORKFramework.Interpolate.EaseOutSine ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

sinusoidal easing out - decelerating to zero velocity

◆ Linear()

static float ORKFramework.Interpolate.Linear ( float  start,
float  distance,
float  elapsedTime,
float  duration 
)
static

Linear interpolation (same as Mathf.Lerp)