メイン・コンテンツまでスキップ

EasingEquations

touchgfx/EasingEquations.hpp

Defines the "Penner easing functions", which are a de facto standard for computing aesthetically pleasing motion animations. See http://easings.net/ for visual illustrations of the easing equations.

Public Functions

int16_tbackEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Back easing in: Overshooting cubic easing: (s+1)t^3 - st^2.
int16_tbackEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Back easing in/out: Overshooting cubic easing: (s+1)t^3 - st^2.
int16_tbackEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Back easing out: Overshooting cubic easing: (s+1)t^3 - st^2.
int16_tbounceEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Bounce easing in - exponentially decaying parabolic bounce.
int16_tbounceEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Bounce easing in/out - exponentially decaying parabolic bounce.
int16_tbounceEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Bounce easing out - exponentially decaying parabolic bounce.
int16_tcircEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Circular easing in: sqrt(1-t^2).
int16_tcircEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Circular easing in/out: sqrt(1-t^2).
int16_tcircEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Circular easing out: sqrt(1-t^2).
int16_tcubicEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Cubic easing in: t^3.
int16_tcubicEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Cubic easing in/out: t^3.
int16_tcubicEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Cubic easing out: t^3.
int16_telasticEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Elastic easing in - exponentially decaying sine wave.
int16_telasticEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Elastic easing in/out - exponentially decaying sine wave.
int16_telasticEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Elastic easing out - exponentially decaying sine wave.
int16_texpoEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Exponential easing in: 2^t.
int16_texpoEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Exponential easing in/out: 2^t.
int16_texpoEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Exponential easing out: 2^t.
int16_tlinearEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Simple linear tweening - no easing.
int16_tlinearEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Simple linear tweening - no easing.
int16_tlinearEaseNone(uint16_t t, int16_t b, int16_t c, uint16_t d)
Simple linear tweening - no easing.
int16_tlinearEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Simple linear tweening - no easing.
int16_tquadEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quadratic easing in: t^2.
int16_tquadEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quadratic easing in/out: t^2.
int16_tquadEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quadratic easing out: t^2.
int16_tquartEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quartic easing in: t^4.
int16_tquartEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quartic easing in/out: t^4.
int16_tquartEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quartic easing out: t^4.
int16_tquintEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quintic/strong easing in: t^5.
int16_tquintEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quintic/strong easing in/out: t^5.
int16_tquintEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Quintic/strong easing out: t^5.
int16_tsineEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d)
Sinusoidal easing in: sin(t).
int16_tsineEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Sinusoidal easing in/out: sin(t).
int16_tsineEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d)
Sinusoidal easing out: sin(t).

Public Functions Documentation

backEaseIn

static int16_t backEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Back easing in: Overshooting cubic easing: (s+1)t^3 - st^2.

Backtracking slightly, then reversing direction and moving to target.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

backEaseInOut

static int16_t backEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Back easing in/out: Overshooting cubic easing: (s+1)t^3 - st^2.

Backtracking slightly, then reversing direction and moving to target, then overshooting target, reversing, and finally coming back to target.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

backEaseOut

static int16_t backEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Back easing out: Overshooting cubic easing: (s+1)t^3 - st^2.

Moving towards target, overshooting it slightly, then reversing and coming back to target.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

bounceEaseIn

static int16_t bounceEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Bounce easing in - exponentially decaying parabolic bounce.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

bounceEaseInOut

static int16_t bounceEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Bounce easing in/out - exponentially decaying parabolic bounce.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

bounceEaseOut

static int16_t bounceEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Bounce easing out - exponentially decaying parabolic bounce.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

circEaseIn

static int16_t circEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Circular easing in: sqrt(1-t^2).

Accelerating from zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

circEaseInOut

static int16_t circEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Circular easing in/out: sqrt(1-t^2).

Acceleration until halfway, then deceleration.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

circEaseOut

static int16_t circEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Circular easing out: sqrt(1-t^2).

Decelerating to zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

cubicEaseIn

static int16_t cubicEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Cubic easing in: t^3.

Accelerating from zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

cubicEaseInOut

static int16_t cubicEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Cubic easing in/out: t^3.

Acceleration until halfway, then deceleration.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

cubicEaseOut

static int16_t cubicEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Cubic easing out: t^3.

Decelerating to zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

elasticEaseIn

static int16_t elasticEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Elastic easing in - exponentially decaying sine wave.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

elasticEaseInOut

static int16_t elasticEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Elastic easing in/out - exponentially decaying sine wave.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

elasticEaseOut

static int16_t elasticEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Elastic easing out - exponentially decaying sine wave.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

expoEaseIn

static int16_t expoEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Exponential easing in: 2^t.

Accelerating from zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

expoEaseInOut

static int16_t expoEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Exponential easing in/out: 2^t.

Accelerating until halfway, then decelerating.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

expoEaseOut

static int16_t expoEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Exponential easing out: 2^t.

Deceleration to zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

linearEaseIn

static int16_t linearEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Simple linear tweening - no easing.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

linearEaseInOut

static int16_t linearEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Simple linear tweening - no easing.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

linearEaseNone

static int16_t linearEaseNone(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Simple linear tweening - no easing.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

linearEaseOut

static int16_t linearEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Simple linear tweening - no easing.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quadEaseIn

static int16_t quadEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quadratic easing in: t^2.

Accelerating from zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quadEaseInOut

static int16_t quadEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quadratic easing in/out: t^2.

Acceleration until halfway, then deceleration.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quadEaseOut

static int16_t quadEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quadratic easing out: t^2.

Decelerating to zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quartEaseIn

static int16_t quartEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quartic easing in: t^4.

Accelerating from zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quartEaseInOut

static int16_t quartEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quartic easing in/out: t^4.

Acceleration until halfway, then deceleration.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quartEaseOut

static int16_t quartEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quartic easing out: t^4.

Decelerating to zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quintEaseIn

static int16_t quintEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quintic/strong easing in: t^5.

Accelerating from zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quintEaseInOut

static int16_t quintEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quintic/strong easing in/out: t^5.

Acceleration until halfway, then deceleration.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

quintEaseOut

static int16_t quintEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Quintic/strong easing out: t^5.

Decelerating to zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

sineEaseIn

static int16_t sineEaseIn(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Sinusoidal easing in: sin(t).

Accelerating from zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

sineEaseInOut

static int16_t sineEaseInOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Sinusoidal easing in/out: sin(t).

Acceleration until halfway, then deceleration.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.

sineEaseOut

static int16_t sineEaseOut(uint16_tt ,
int16_tb ,
int16_tc ,
uint16_td
)

Sinusoidal easing out: sin(t).

Decelerating to zero velocity.

Parameters:
tTime. The current time or step.
bBeginning. The beginning value.
cChange. The change between the beginning value and the destination value.
dDuration. The total time or total number of steps.
Returns:

The current value as a function of the current time or step.