Murl::Math::Easing< DataType > Class Template Reference

The easing class implements the functions of the predefined IEnums::Interpolation curves. More...

#include "murl_math_easing.h"

Public Types

using ValueType = DataType
 The template parameter value type.
 
using Interpolate = DataType(*)(DataType x)
 Definition of the easing function type.
 

Static Public Member Functions

static DataType Constant (DataType x)
 Constant interpolation. More...
 
static DataType Linear (DataType x)
 Linear interpolation. More...
 
static DataType SmoothstepInOut (DataType x)
 Smoothstep "in-out" interpolation. More...
 
static DataType SmoothstepIn (DataType x)
 Smoothstep "in" interpolation. More...
 
static DataType SmoothstepOut (DataType x)
 Smoothstep "out" interpolation. More...
 
static DataType SmoothstepOutIn (DataType x)
 Smoothstep "out-in" interpolation. More...
 
static DataType SmootherstepInOut (DataType x)
 Smootherstep "in-out" interpolation. More...
 
static DataType SmootherstepIn (DataType x)
 Smootherstep "in" interpolation. More...
 
static DataType SmootherstepOut (DataType x)
 Smootherstep "out" interpolation. More...
 
static DataType SmootherstepOutIn (DataType x)
 Smootherstep "out-in" interpolation. More...
 
static DataType EaseIn (DataType x)
 Ease (cubic) "in" interpolation. More...
 
static DataType EaseOut (DataType x)
 Ease (cubic) "out" interpolation. More...
 
static DataType EaseInOut (DataType x)
 Ease (cubic) "in-out" interpolation. More...
 
static DataType EaseOutIn (DataType x)
 Ease (cubic) "out-in" interpolation. More...
 
static DataType EaseQuartIn (DataType x)
 Ease Quart "in" interpolation. More...
 
static DataType EaseQuartOut (DataType x)
 Ease Quart "out" interpolation. More...
 
static DataType EaseQuartInOut (DataType x)
 Ease Quart "in-out" interpolation. More...
 
static DataType EaseQuartOutIn (DataType x)
 Ease Quart "out-in" interpolation. More...
 
static DataType EaseExponentialIn (DataType x)
 Ease Exponential "in" interpolation. More...
 
static DataType EaseExponentialOut (DataType x)
 Ease Exponential "out" interpolation. More...
 
static DataType EaseExponentialInOut (DataType x)
 Ease Exponential "in-out" interpolation. More...
 
static DataType EaseExponentialOutIn (DataType x)
 Ease Exponential "out-in" interpolation. More...
 
static DataType EaseCircularIn (DataType x)
 Ease Circular "in" interpolation. More...
 
static DataType EaseCircularOut (DataType x)
 Ease Circular "out" interpolation. More...
 
static DataType EaseCircularHelper (DataType x)
 Ease Circular helper interpolation. More...
 
static DataType EaseCircularInOut (DataType x)
 Ease Circular "in-out" interpolation. More...
 
static DataType EaseCircularOutIn (DataType x)
 Ease Circular "out-in" interpolation. More...
 
static DataType EaseBackIn (DataType x)
 Ease Back "in" interpolation. More...
 
static DataType EaseBackOut (DataType x)
 Ease Back "out" interpolation. More...
 
static DataType EaseBackInOut (DataType x)
 Ease Back "in-out" interpolation. More...
 
static DataType EaseBackOutIn (DataType x)
 Ease Back "out-in" interpolation. More...
 
static DataType EaseElasticIn (DataType x)
 Ease Elastic "in" interpolation. More...
 
static DataType EaseElasticOut (DataType x)
 Ease Elastic "out" interpolation. More...
 
static DataType EaseElasticInOut (DataType x)
 Ease Elastic "in-out" interpolation. More...
 
static DataType EaseElasticOutIn (DataType x)
 Ease Elastic "out-in" interpolation. More...
 
static DataType EaseBounceOut (DataType x)
 Ease Bounce "out" interpolation. More...
 
static DataType EaseBounceIn (DataType x)
 Ease Bounce "in" interpolation. More...
 
static DataType EaseBounceInOut (DataType x)
 Ease Bounce "in-out" interpolation. More...
 
static DataType EaseBounceOutIn (DataType x)
 Ease Bounce "in-out" interpolation. More...
 

Detailed Description

template<class DataType>
class Murl::Math::Easing< DataType >

The easing class implements the functions of the predefined IEnums::Interpolation curves.

Smoothstep functions description can be found at http://wikipedia.org/wiki/Smoothstep
Easing functions description can be found at http://easings.net

Member Function Documentation

◆ Constant()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::Constant ( DataType  x)
inlinestatic

Constant interpolation.

Function: f(x)=0

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

◆ Linear()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::Linear ( DataType  x)
inlinestatic

Linear interpolation.

Function: f(x)=x

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

◆ SmoothstepInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmoothstepInOut ( DataType  x)
inlinestatic

Smoothstep "in-out" interpolation.

Function: f(x)=(x^2)*(3-2*x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

Referenced by Murl::Math::Easing< DataType >::SmoothstepIn(), Murl::Math::Easing< DataType >::SmoothstepOut(), and Murl::Math::Easing< DataType >::SmoothstepOutIn().

◆ SmoothstepIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmoothstepIn ( DataType  x)
inlinestatic

Smoothstep "in" interpolation.

Function: f(x)=SmoothstepInOut(x/2)*2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::SmoothstepInOut().

◆ SmoothstepOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmoothstepOut ( DataType  x)
inlinestatic

Smoothstep "out" interpolation.

Function: f(x)=SmoothstepInOut((x+1)/2)*2-1

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::SmoothstepInOut().

◆ SmoothstepOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmoothstepOutIn ( DataType  x)
inlinestatic

Smoothstep "out-in" interpolation.

Function: f(x)=(x < 0.5) ? SmoothstepInOut(x+0.5)-0.5 : SmoothstepInOut(x-0.5)+0.5

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::SmoothstepInOut().

◆ SmootherstepInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmootherstepInOut ( DataType  x)
inlinestatic

Smootherstep "in-out" interpolation.

Function: f(x)=(x^3)*(x*(6*x-15)+10)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

Referenced by Murl::Math::Easing< DataType >::SmootherstepIn(), Murl::Math::Easing< DataType >::SmootherstepOut(), and Murl::Math::Easing< DataType >::SmootherstepOutIn().

◆ SmootherstepIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmootherstepIn ( DataType  x)
inlinestatic

Smootherstep "in" interpolation.

Function: f(x)=SmootherstepInOut(x/2)*2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::SmootherstepInOut().

◆ SmootherstepOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmootherstepOut ( DataType  x)
inlinestatic

Smootherstep "out" interpolation.

Function: f(x)=SmootherstepInOut((x+1)/2)*2-1

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::SmootherstepInOut().

◆ SmootherstepOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::SmootherstepOutIn ( DataType  x)
inlinestatic

Smootherstep "out-in" interpolation.

Function: f(x)=(x < 0.5) ? SmootherstepInOut(x+0.5)-0.5 : SmootherstepInOut(x-0.5)+0.5

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::SmootherstepInOut().

◆ EaseIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseIn ( DataType  x)
inlinestatic

Ease (cubic) "in" interpolation.

Function: f(x)=x^3

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

Referenced by Murl::Math::Easing< DataType >::EaseInOut(), Murl::Math::Easing< DataType >::EaseOut(), and Murl::Math::Easing< DataType >::EaseOutIn().

◆ EaseOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseOut ( DataType  x)
inlinestatic

Ease (cubic) "out" interpolation.

Function: f(x)=1-EaseIn(1-x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseIn().

◆ EaseInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseInOut ( DataType  x)
inlinestatic

Ease (cubic) "in-out" interpolation.

Function: f(x)=(x < 0.5) ? EaseIn(2*x)/2 : 1-EaseIn(2-2*x)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseIn().

◆ EaseOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseOutIn ( DataType  x)
inlinestatic

Ease (cubic) "out-in" interpolation.

Function: f(x)=4*EaseIn(x-0.5)+0.5

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseIn().

◆ EaseQuartIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseQuartIn ( DataType  x)
inlinestatic

Ease Quart "in" interpolation.

Function: f(x)=x^4

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

Referenced by Murl::Math::Easing< DataType >::EaseQuartInOut(), Murl::Math::Easing< DataType >::EaseQuartOut(), and Murl::Math::Easing< DataType >::EaseQuartOutIn().

◆ EaseQuartOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseQuartOut ( DataType  x)
inlinestatic

Ease Quart "out" interpolation.

Function: f(x)=1-EaseQuartIn(1-x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseQuartIn().

◆ EaseQuartInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseQuartInOut ( DataType  x)
inlinestatic

Ease Quart "in-out" interpolation.

Function: f(x)=(x < 0.5) ? EaseQuartIn(2*x)/2 : 1-EaseQuartIn(2-2*x)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseQuartIn().

◆ EaseQuartOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseQuartOutIn ( DataType  x)
inlinestatic

Ease Quart "out-in" interpolation.

Function: f(x)=(x < 0.5) ? 0.5-EaseQuartIn(1-2*x)/2 : 0.5+EaseQuartIn(2*x-1)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseQuartIn().

◆ EaseExponentialIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseExponentialIn ( DataType  x)
inlinestatic

Ease Exponential "in" interpolation.

Function: f(x)=(2^8x)*x/256

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Pow().

Referenced by Murl::Math::Easing< DataType >::EaseExponentialInOut(), Murl::Math::Easing< DataType >::EaseExponentialOut(), and Murl::Math::Easing< DataType >::EaseExponentialOutIn().

◆ EaseExponentialOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseExponentialOut ( DataType  x)
inlinestatic

Ease Exponential "out" interpolation.

Function: f(x)=1-EaseExponentialIn(1-x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseExponentialIn().

◆ EaseExponentialInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseExponentialInOut ( DataType  x)
inlinestatic

Ease Exponential "in-out" interpolation.

Function: f(x)=(x < 0.5) ? EaseExponentialIn(2*x)/2 : 1-EaseExponentialIn(2-2*x)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseExponentialIn().

◆ EaseExponentialOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseExponentialOutIn ( DataType  x)
inlinestatic

Ease Exponential "out-in" interpolation.

Function: f(x)=(x < 0.5) ? 0.5-EaseExponentialIn(1-2*x)/2 : 0.5+EaseExponentialIn(2*x-1)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseExponentialIn().

◆ EaseCircularIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseCircularIn ( DataType  x)
inlinestatic

Ease Circular "in" interpolation.

Function: f(x)=1-sqrt(1-x^2)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Sqrt().

◆ EaseCircularOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseCircularOut ( DataType  x)
inlinestatic

Ease Circular "out" interpolation.

Function: f(x)=sqrt((2-x)*x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Sqrt().

◆ EaseCircularHelper()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseCircularHelper ( DataType  x)
inlinestatic

Ease Circular helper interpolation.

Function: f(x)=sqrt(x-x^2)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Sqrt().

Referenced by Murl::Math::Easing< DataType >::EaseCircularInOut(), and Murl::Math::Easing< DataType >::EaseCircularOutIn().

◆ EaseCircularInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseCircularInOut ( DataType  x)
inlinestatic

Ease Circular "in-out" interpolation.

Function: f(x)=(x < 0.5) ? 0.5-EaseCircularHelper(x+0.5) : 0.5+EaseCircularHelper(x-0.5)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseCircularHelper().

◆ EaseCircularOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseCircularOutIn ( DataType  x)
inlinestatic

Ease Circular "out-in" interpolation.

Function: f(x)=(x < 0.5) ? EaseCircularHelper(x) : 1-EaseCircularHelper(x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseCircularHelper().

◆ EaseBackIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBackIn ( DataType  x)
inlinestatic

Ease Back "in" interpolation.

Function: f(x)=(x^3)-x*sin(x*PI)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::PI, and Murl::Math::Sin().

Referenced by Murl::Math::Easing< DataType >::EaseBackInOut(), Murl::Math::Easing< DataType >::EaseBackOut(), and Murl::Math::Easing< DataType >::EaseBackOutIn().

◆ EaseBackOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBackOut ( DataType  x)
inlinestatic

Ease Back "out" interpolation.

Function: f(x)=1-EaseBackIn(1-x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseBackIn().

◆ EaseBackInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBackInOut ( DataType  x)
inlinestatic

Ease Back "in-out" interpolation.

Function: f(x)=(x < 0.5) ? EaseBackIn(2*x)/2 : 1-EaseBackIn(2-2*x)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseBackIn().

◆ EaseBackOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBackOutIn ( DataType  x)
inlinestatic

Ease Back "out-in" interpolation.

Function: f(x)=(x < 0.5) ? 0.5-EaseBackIn(1-2*x)/2 : 0.5+EaseBackIn(2*x-1)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseBackIn().

◆ EaseElasticIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseElasticIn ( DataType  x)
inlinestatic

Ease Elastic "in" interpolation.

Function: f(x)=sin(13*PI/2*x)*2^(10*(x-1))

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::HALF_PI, Murl::Math::Pow(), and Murl::Math::Sin().

Referenced by Murl::Math::Easing< DataType >::EaseElasticInOut(), Murl::Math::Easing< DataType >::EaseElasticOut(), and Murl::Math::Easing< DataType >::EaseElasticOutIn().

◆ EaseElasticOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseElasticOut ( DataType  x)
inlinestatic

Ease Elastic "out" interpolation.

Function: f(x)=1-EaseElasticIn(1-x)

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseElasticIn().

◆ EaseElasticInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseElasticInOut ( DataType  x)
inlinestatic

Ease Elastic "in-out" interpolation.

Function: f(x)=(x < 0.5) ? EaseElasticIn(2*x)/2 : 1-EaseElasticIn(2-2*x)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseElasticIn().

◆ EaseElasticOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseElasticOutIn ( DataType  x)
inlinestatic

Ease Elastic "out-in" interpolation.

Function: f(x)=(x < 0.5) ? 0.5-EaseElasticIn(1-2*x)/2 : 0.5+EaseElasticIn(2*x-1)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseElasticIn().

◆ EaseBounceOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBounceOut ( DataType  x)
inlinestatic

Ease Bounce "out" interpolation.

Function: f(x)= ... = a halve and three shrinking bounces

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

Referenced by Murl::Math::Easing< DataType >::EaseBounceIn(), Murl::Math::Easing< DataType >::EaseBounceInOut(), and Murl::Math::Easing< DataType >::EaseBounceOutIn().

◆ EaseBounceIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBounceIn ( DataType  x)
inlinestatic

Ease Bounce "in" interpolation.

Function: f(x)=1-EaseBounceOut(1-x) = three and a halve growing bounces

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseBounceOut().

Referenced by Murl::Math::Easing< DataType >::EaseBounceInOut(), and Murl::Math::Easing< DataType >::EaseBounceOutIn().

◆ EaseBounceInOut()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBounceInOut ( DataType  x)
inlinestatic

Ease Bounce "in-out" interpolation.

Function: f(x)=(x < 0.5) ? EaseBounceIn(2*x)/2 : 0.5+EaseBounceOut(2*x-1)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseBounceIn(), and Murl::Math::Easing< DataType >::EaseBounceOut().

◆ EaseBounceOutIn()

template<class DataType >
static DataType Murl::Math::Easing< DataType >::EaseBounceOutIn ( DataType  x)
inlinestatic

Ease Bounce "in-out" interpolation.

Function: f(x)=(x < 0.5) ? EaseBounceOut(2*x)/2 : 0.5+EaseBounceIn(2*x-1)/2

Parameters
xThe value to interpolate in range [0 .. 1].
Returns
The result for f(x).

References Murl::Math::Easing< DataType >::EaseBounceIn(), and Murl::Math::Easing< DataType >::EaseBounceOut().


The documentation for this class was generated from the following file:
  • murl_math_easing.h


Copyright © 2011-2024 Spraylight GmbH.