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_t | backEaseIn(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_t | backEaseInOut(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_t | backEaseOut(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_t | bounceEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Bounce easing in - exponentially decaying parabolic bounce. | |
int16_t | bounceEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Bounce easing in/out - exponentially decaying parabolic bounce. | |
int16_t | bounceEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Bounce easing out - exponentially decaying parabolic bounce. | |
int16_t | circEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Circular easing in: sqrt(1-t^2). | |
int16_t | circEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Circular easing in/out: sqrt(1-t^2). | |
int16_t | circEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Circular easing out: sqrt(1-t^2). | |
int16_t | cubicEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Cubic easing in: t^3. | |
int16_t | cubicEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Cubic easing in/out: t^3. | |
int16_t | cubicEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Cubic easing out: t^3. | |
int16_t | elasticEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Elastic easing in - exponentially decaying sine wave. | |
int16_t | elasticEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Elastic easing in/out - exponentially decaying sine wave. | |
int16_t | elasticEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Elastic easing out - exponentially decaying sine wave. | |
int16_t | expoEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Exponential easing in: 2^t. | |
int16_t | expoEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Exponential easing in/out: 2^t. | |
int16_t | expoEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Exponential easing out: 2^t. | |
int16_t | linearEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Simple linear tweening - no easing. | |
int16_t | linearEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Simple linear tweening - no easing. | |
int16_t | linearEaseNone(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Simple linear tweening - no easing. | |
int16_t | linearEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Simple linear tweening - no easing. | |
int16_t | quadEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quadratic easing in: t^2. | |
int16_t | quadEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quadratic easing in/out: t^2. | |
int16_t | quadEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quadratic easing out: t^2. | |
int16_t | quartEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quartic easing in: t^4. | |
int16_t | quartEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quartic easing in/out: t^4. | |
int16_t | quartEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quartic easing out: t^4. | |
int16_t | quintEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quintic/strong easing in: t^5. | |
int16_t | quintEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quintic/strong easing in/out: t^5. | |
int16_t | quintEaseOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Quintic/strong easing out: t^5. | |
int16_t | sineEaseIn(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Sinusoidal easing in: sin(t). | |
int16_t | sineEaseInOut(uint16_t t, int16_t b, int16_t c, uint16_t d) |
Sinusoidal easing in/out: sin(t). | |
int16_t | sineEaseOut(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_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Back easing in: Overshooting cubic easing: (s+1)t^3 - st^2.
Backtracking slightly, then reversing direction and moving to target.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
backEaseInOut
static int16_t backEaseInOut | ( | 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.
Backtracking slightly, then reversing direction and moving to target, then overshooting target, reversing, and finally coming back to target.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
backEaseOut
static int16_t backEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
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.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
bounceEaseIn
static int16_t bounceEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Bounce easing in - exponentially decaying parabolic bounce.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
bounceEaseInOut
static int16_t bounceEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Bounce easing in/out - exponentially decaying parabolic bounce.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
bounceEaseOut
static int16_t bounceEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Bounce easing out - exponentially decaying parabolic bounce.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
circEaseIn
static int16_t circEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Circular easing in: sqrt(1-t^2).
Accelerating from zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
circEaseInOut
static int16_t circEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Circular easing in/out: sqrt(1-t^2).
Acceleration until halfway, then deceleration.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
circEaseOut
static int16_t circEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Circular easing out: sqrt(1-t^2).
Decelerating to zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
cubicEaseIn
static int16_t cubicEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Cubic easing in: t^3.
Accelerating from zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
cubicEaseInOut
static int16_t cubicEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Cubic easing in/out: t^3.
Acceleration until halfway, then deceleration.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
cubicEaseOut
static int16_t cubicEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Cubic easing out: t^3.
Decelerating to zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
elasticEaseIn
static int16_t elasticEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Elastic easing in - exponentially decaying sine wave.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
elasticEaseInOut
static int16_t elasticEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Elastic easing in/out - exponentially decaying sine wave.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
elasticEaseOut
static int16_t elasticEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Elastic easing out - exponentially decaying sine wave.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
expoEaseIn
static int16_t expoEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Exponential easing in: 2^t.
Accelerating from zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
expoEaseInOut
static int16_t expoEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Exponential easing in/out: 2^t.
Accelerating until halfway, then decelerating.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
expoEaseOut
static int16_t expoEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Exponential easing out: 2^t.
Deceleration to zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
linearEaseIn
static int16_t linearEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Simple linear tweening - no easing.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
linearEaseInOut
static int16_t linearEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Simple linear tweening - no easing.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
linearEaseNone
static int16_t linearEaseNone | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Simple linear tweening - no easing.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
linearEaseOut
static int16_t linearEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Simple linear tweening - no easing.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quadEaseIn
static int16_t quadEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quadratic easing in: t^2.
Accelerating from zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quadEaseInOut
static int16_t quadEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quadratic easing in/out: t^2.
Acceleration until halfway, then deceleration.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quadEaseOut
static int16_t quadEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quadratic easing out: t^2.
Decelerating to zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quartEaseIn
static int16_t quartEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quartic easing in: t^4.
Accelerating from zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quartEaseInOut
static int16_t quartEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quartic easing in/out: t^4.
Acceleration until halfway, then deceleration.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quartEaseOut
static int16_t quartEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quartic easing out: t^4.
Decelerating to zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quintEaseIn
static int16_t quintEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quintic/strong easing in: t^5.
Accelerating from zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quintEaseInOut
static int16_t quintEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quintic/strong easing in/out: t^5.
Acceleration until halfway, then deceleration.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
quintEaseOut
static int16_t quintEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Quintic/strong easing out: t^5.
Decelerating to zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
sineEaseIn
static int16_t sineEaseIn | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Sinusoidal easing in: sin(t).
Accelerating from zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
sineEaseInOut
static int16_t sineEaseInOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Sinusoidal easing in/out: sin(t).
Acceleration until halfway, then deceleration.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.
sineEaseOut
static int16_t sineEaseOut | ( | uint16_t | t , | ||
int16_t | b , | ||||
int16_t | c , | ||||
uint16_t | d | ||||
) |
Sinusoidal easing out: sin(t).
Decelerating to zero velocity.
t | Time. The current time or step. |
b | Beginning. The beginning value. |
c | Change. The change between the beginning value and the destination value. |
d | Duration. The total time or total number of steps. |
The current value as a function of the current time or step.