CUGL 2.3
Cornell University Game Library
Loading...
Searching...
No Matches
Public Types | Static Public Member Functions | List of all members
cugl::EasingFunction Class Reference

#include <CUEasingFunction.h>

Public Types

enum class  Type : int {
  LINEAR , SINE_IN , SINE_OUT , SINE_IN_OUT ,
  QUAD_IN , QUAD_OUT , QUAD_IN_OUT , CUBIC_IN ,
  CUBIC_OUT , CUBIC_IN_OUT , QUART_IN , QUART_OUT ,
  QUART_IN_OUT , QUINT_IN , QUINT_OUT , QUINT_IN_OUT ,
  EXPO_IN , EXPO_OUT , EXPO_IN_OUT , CIRC_IN ,
  CIRC_OUT , CIRC_IN_OUT , BACK_IN , BACK_OUT ,
  BACK_IN_OUT , BOUNCE_IN , BOUNCE_OUT , BOUNCE_IN_OUT ,
  ELASTIC_IN , ELASTIC_OUT , ELASTIC_IN_OUT
}
 

Static Public Member Functions

static std::function< float(float)> alloc ()
 
static std::function< float(float)> alloc (Type type, float period=ELASTIC_PERIOD)
 
static float linear (float time)
 
static float sineIn (float time)
 
static float sineOut (float time)
 
static float sineInOut (float time)
 
static float quadIn (float time)
 
static float quadOut (float time)
 
static float quadInOut (float time)
 
static float cubicIn (float time)
 
static float cubicOut (float time)
 
static float cubicInOut (float time)
 
static float quartIn (float time)
 
static float quartOut (float time)
 
static float quartInOut (float time)
 
static float quintIn (float time)
 
static float quintOut (float time)
 
static float quintInOut (float time)
 
static float expoIn (float time)
 
static float expoOut (float time)
 
static float expoInOut (float time)
 
static float circIn (float time)
 
static float circOut (float time)
 
static float circInOut (float time)
 
static float backIn (float time)
 
static float backOut (float time)
 
static float backInOut (float time)
 
static float bounceIn (float time)
 
static float bounceOut (float time)
 
static float bounceInOut (float time)
 
static float elasticIn (float time, float period)
 
static float elasticOut (float time, float period)
 
static float elasticInOut (float time, float period)
 

Detailed Description

This class is a factory for returning easing functions.

An easing function is an interpolation function that (usually) maps [0,1] to [0,1] with f(0) = 0 and f(1) = 1. It is used to control the speed of a tweening operation. If f(t) = t, the result is standard linear interpolation, providing a smooth animation. Nonlinear curves allow the tweening to adjust its speed over time. An easing function can map outside of the range so long as the end points are still fixed. This allows for overshoot and correction in the tweening.

The supported easing functions are all implemented as static methods. The alloc() method is used to return a function value that can can be used by other functions for tweening support.

Member Enumeration Documentation

◆ Type

enum class cugl::EasingFunction::Type : int
strong

This enum lists the easing functions supported by this factory.

Enumerator
LINEAR 

A linear easing function (the default)

SINE_IN 

A 1-cosine function with an asymptotic start at t=0

SINE_OUT 

A sine function with an asymptotic finish at t=1

SINE_IN_OUT 

A concatenation of the SINE_IN and SINE_OUT functions

QUAD_IN 

A quadratic polynomial with an asymptotic start at t=0

QUAD_OUT 

A quadratic polynomial with an asymptotic finish at t=1

QUAD_IN_OUT 

A concatenation of the QUAD_IN and QUAD_OUT functions

CUBIC_IN 

A cubic polynomial with an asymptotic start at t=0

CUBIC_OUT 

A cubic polynomial with an asymptotic finish at t=1

CUBIC_IN_OUT 

A concatenation of the CUBIC_IN and CUBIC_OUT functions

QUART_IN 

A fourth-degree polynomial with an asymptotic start at t=0

QUART_OUT 

A fourth-degree polynomial with an asymptotic finish at t=1

QUART_IN_OUT 

A concatenation of the QUART_IN and QUART_OUT functions

QUINT_IN 

A fifth-degree polynomial with an asymptotic start at t=0

QUINT_OUT 

A fifth-degree polynomial with an asymptotic finish at t=1

QUINT_IN_OUT 

A concatenation of the QUINT_IN and QUINT_OUT functions

EXPO_IN 

An exponential function with an asymptotic start at t=0

EXPO_OUT 

An exponential function with an asymptotic finish at t=1

EXPO_IN_OUT 

A concatenation of the EXPO_IN and EXPO_OUT functions

CIRC_IN 

A quarter circle with an asymptotic start at t=0

CIRC_OUT 

A quarter circle with an asymptotic finish at t=1

CIRC_IN_OUT 

A concatenation of the CIRC_IN and CIRC_OUT functions

BACK_IN 

An easing function that briefly dips below t=0 after the start

BACK_OUT 

An easing function that briefly rises above t=1 before the finish

BACK_IN_OUT 

A concatenation of the BACK_IN and BACK_OUT functions

BOUNCE_IN 

An easing function that bounces down to t=0 several times after the start.

BOUNCE_OUT 

An easing function that bounces up to t=1 several times before this finish.

BOUNCE_IN_OUT 

A concatenation of the BOUNCE_IN and BOUNCE_OUT functions

ELASTIC_IN 

An easing function that bounces back-and-forth across t=0 several times after the start.

ELASTIC_OUT 

An easing function that bounces back-and-forth across t=1 several times before the finish.

ELASTIC_IN_OUT 

A concatenation of the ELASTIC_IN and ELASTIC_OUT functions

Member Function Documentation

◆ alloc() [1/2]

static std::function< float(float)> cugl::EasingFunction::alloc ( )
inlinestatic

Returns a linear easing function

Returns
A linear easing function

◆ alloc() [2/2]

static std::function< float(float)> cugl::EasingFunction::alloc ( Type  type,
float  period = ELASTIC_PERIOD 
)
static

Returns an easing function of the given type.

The optional value period only applies to elastic easing functions, as their bounce factor is adjustable.

Parameters
typeThe easing function type
periodThe period of an elastic easing function
Returns
An easing function of the given type.

◆ backIn()

static float cugl::EasingFunction::backIn ( float  time)
static

Returns an adjustment of the tweening time

This is an easing function that briefly dips below t=0 after the start.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ backInOut()

static float cugl::EasingFunction::backInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the backIn(float) and backOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ backOut()

static float cugl::EasingFunction::backOut ( float  time)
static

Returns an adjustment of the tweening time

This is an easing function that briefly rises above t=1 before the finish.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ bounceIn()

static float cugl::EasingFunction::bounceIn ( float  time)
static

Returns an adjustment of the tweening time

This is an easing function that bounces down to t=0 several times after the start.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ bounceInOut()

static float cugl::EasingFunction::bounceInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the bounceIn(float) and bounceOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ bounceOut()

static float cugl::EasingFunction::bounceOut ( float  time)
static

Returns an adjustment of the tweening time

This is an easing function that bounces up to t=1 several times before the finish.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ circIn()

static float cugl::EasingFunction::circIn ( float  time)
static

Returns an adjustment of the tweening time

This is a quarter circle with an asymptotic start at t=0.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ circInOut()

static float cugl::EasingFunction::circInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the circIn(float) and circOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ circOut()

static float cugl::EasingFunction::circOut ( float  time)
static

Returns an adjustment of the tweening time

This is a quarter circle with an asymptotic finish at t=1.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ cubicIn()

static float cugl::EasingFunction::cubicIn ( float  time)
static

Returns an adjustment of the tweening time

This is a cubic polynomial with an asymptotic start at t=0.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ cubicInOut()

static float cugl::EasingFunction::cubicInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the cubicIn(float) and cubicOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ cubicOut()

static float cugl::EasingFunction::cubicOut ( float  time)
static

Returns an adjustment of the tweening time

This is a cubic polynomial with an asymptotic finish at t=1.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ elasticIn()

static float cugl::EasingFunction::elasticIn ( float  time,
float  period 
)
static

Returns an adjustment of the tweening time

This is an easing function that bounces back-and-forth across t=0 several times after the start.

Parameters
timeThe time in seconds.
periodThe period in seconds.
Returns
An adjustment of the tweening time

◆ elasticInOut()

static float cugl::EasingFunction::elasticInOut ( float  time,
float  period 
)
static

Returns an adjustment of the tweening time

This is a concatenation of the elasticIn(float,float) and elasticOut(float,float) easing functions.

Parameters
timeThe time in seconds.
periodThe period in seconds.
Returns
An adjustment of the tweening time

◆ elasticOut()

static float cugl::EasingFunction::elasticOut ( float  time,
float  period 
)
static

Returns an adjustment of the tweening time

This is an easing function that bounces back-and-forth across t=1 several times before the finish.

Parameters
timeThe time in seconds.
periodThe period in seconds.
Returns
An adjustment of the tweening time

◆ expoIn()

static float cugl::EasingFunction::expoIn ( float  time)
static

Returns an adjustment of the tweening time

This is an exponential function with an asymptotic start at t=0.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ expoInOut()

static float cugl::EasingFunction::expoInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the expoIn(float) and expoOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ expoOut()

static float cugl::EasingFunction::expoOut ( float  time)
static

Returns an adjustment of the tweening time

This is an exponential function with an asymptotic finish at t=1.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ linear()

static float cugl::EasingFunction::linear ( float  time)
static

Returns an adjustment of the tweening time

This is a linear easing function (the default)

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quadIn()

static float cugl::EasingFunction::quadIn ( float  time)
static

Returns an adjustment of the tweening time

This is a quadratic polynomial with an asymptotic start at t=0.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quadInOut()

static float cugl::EasingFunction::quadInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the quadIn(float) and quadOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quadOut()

static float cugl::EasingFunction::quadOut ( float  time)
static

Returns an adjustment of the tweening time

This is a quadratic polynomial with an asymptotic finish at t=1.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quartIn()

static float cugl::EasingFunction::quartIn ( float  time)
static

Returns an adjustment of the tweening time

This is a fourth-degree polynomial with an asymptotic start at t=0.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quartInOut()

static float cugl::EasingFunction::quartInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the quartIn(float) and quartOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quartOut()

static float cugl::EasingFunction::quartOut ( float  time)
static

Returns an adjustment of the tweening time

This is a fourth-degree polynomial with an asymptotic finish at t=1.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quintIn()

static float cugl::EasingFunction::quintIn ( float  time)
static

Returns an adjustment of the tweening time

This is a fifth-degree polynomial with an asymptotic start at t=0.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quintInOut()

static float cugl::EasingFunction::quintInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the quintIn(float) and quintOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ quintOut()

static float cugl::EasingFunction::quintOut ( float  time)
static

Returns an adjustment of the tweening time

This is a fifth-degree polynomial with an asymptotic finish at t=1.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ sineIn()

static float cugl::EasingFunction::sineIn ( float  time)
static

Returns an adjustment of the tweening time

This is a linear easing function (the default)

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ sineInOut()

static float cugl::EasingFunction::sineInOut ( float  time)
static

Returns an adjustment of the tweening time

This is a concatenation of the sineIn(float) and sineOut(float) easing functions.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

◆ sineOut()

static float cugl::EasingFunction::sineOut ( float  time)
static

Returns an adjustment of the tweening time

This is a sine function with an asymptotic finish at t=1.

Parameters
timeThe time in seconds.
Returns
An adjustment of the tweening time

The documentation for this class was generated from the following file: