Easings
A collection of easing functions and a physics-based spring generator
Use the Easing Functions Editor to visualize, create and customize easing functions.
All easing functions are available on the easings
object imported from the main 'animejs'
module:
import { easings } from 'animejs';
easings.eases.inOut(3);
easings.cubicBezier(.7, .1, .5, .9);
easings.spring({ bounce: .35 });
Or imported directly from the main 'animejs'
module:
import { eases, cubicBezier, spring } from 'animejs';
eases.inOut(3);
cubicBezier(.7, .1, .5, .9);
spring({ bounce: .35 });
Or imported as a standalone module from the 'animejs/easings'
subpath:
import { eases, cubicBezier, spring } from 'animejs/easings';
Easing and spring functions can be passed to the ease
and playbackEase
parameters of the animate()
method or the ease
parameter of the stagger()
function.
import { cubicBezier, linear, spring } from 'animejs';
animate(target, { x: 100, ease: 'inOut(3)' });
animate(target, { x: 100, ease: cubicBezier(.7, .1, .5, .9) });
animate(target, { x: 100, ease: spring({ bounce: .35 }) });
Easings code example
import { animate, waapi, cubicBezier, spring } from 'animejs';
animate('.row:nth-child(1) .square', {
x: '17rem',
rotate: 360,
ease: 'out(3)', // Built-in ease
});
animate('.row:nth-child(2) .square', {
x: '17rem',
rotate: 360,
ease: cubicBezier(.7, .1, .5, .9), // Custom cubic Bezier curves
});
waapi.animate('.row:nth-child(3) .square', {
x: '17rem',
rotate: 360,
ease: spring({ bounce: .35 }), // Spring physics
});
<div class="medium row">
<div class="square"></div>
<div class="padded label">'inQuad'</div>
</div>
<div class="medium row">
<div class="square"></div>
<div class="padded label">cubicBezier(.7, .1, .5, .9)</div>
</div>
<div class="medium row">
<div class="square"></div>
<div class="padded label">spring({ bounce: 1.25 })</div>
</div>
In this section