Easing module implements common easing functions. This module is used by
Animated.timing() to convey physically believable motion in animations.
You can find a visualization of some common easing functions at https://easings.net/
Easing module provides several predefined animations through the following methods:
backprovides a basic animation where the object goes slightly back before moving forward
bounceprovides a bouncing animation
easeprovides a basic inertial animation
elasticprovides a basic spring interaction
Three standard easing functions are provided:
poly function can be used to implement quartic, quintic, and other higher power functions.
Additional mathematical functions are provided by the following methods:
bezierprovides a cubic bezier curve
circleprovides a circular function
sinprovides a sinusoidal function
expprovides an exponential function
The following helpers are used to modify other easing functions.
inruns an easing function forwards
inOutmakes any easing function symmetrical
outruns an easing function backwards
static step0(n: number);
A stepping function, returns 1 for any positive value of
static step1(n: number);
A stepping function, returns 1 if
n is greater than or equal to 1.
static linear(t: number);
A linear function,
f(t) = t. Position correlates to elapsed time one to one.
static ease(t: number);
A basic inertial interaction, similar to an object slowly accelerating to speed.
static quad(t: number);
A quadratic function,
f(t) = t * t. Position equals the square of elapsed time.
static cubic(t: number);
A cubic function,
f(t) = t * t * t. Position equals the cube of elapsed time.
static poly(n: number);
A power function. Position is equal to the Nth power of elapsed time.
static sin(t: number);
A sinusoidal function.
static circle(t: number);
A circular function.
static exp(t: number);
An exponential function.
static elastic(bounciness: number);
A basic elastic interaction, similar to a spring oscillating back and forth.
Default bounciness is 1, which overshoots a little bit once. 0 bounciness doesn't overshoot at all, and bounciness of N > 1 will overshoot about N times.
Animated.parallel() to create a basic effect where the object animates back slightly as the animation starts.
static bounce(t: number);
Provides a basic bouncing effect.
static bezier(x1: number, y1: number, x2: number, y2: number);
Provides a cubic bezier curve, equivalent to CSS Transitions'
A useful tool to visualize cubic bezier curves can be found at https://cubic-bezier.com/
static in(easing: number);
Runs an easing function forwards.
static out(easing: number);
Runs an easing function backwards.
static inOut(easing: number);
Makes any easing function symmetrical. The easing function will run forwards for half of the duration, then backwards for the rest of the duration.