@gamestdio/easing
v1.0.0
Published
Collection of easing equations for JavaScript / TypeScript
Downloads
9
Maintainers
Readme
@gamestdio/easing
This is a grab-bag of Robert Penner's easing equations, most of the code from glsl-easings. Pull requests for optimizations are welcome.
Usage
Each easing has its own file which can be required individually. The entry point also exports all eases with camelCase, so require('eases/expo-in-out')
becomes require('eases').expoInOut
.
Full list of eases:
import { backInOut } from './back-in-out';
import { backIn } from './back-in';
import { backOut } from './back-out';
import { bounceInOut } from './bounce-in-out';
import { bounceIn } from './bounce-in';
import { bounceOut } from './bounce-out';
import { circInOut } from './circ-in-out';
import { circIn } from './circ-in';
import { circOut } from './circ-out';
import { cubicInOut } from './cubic-in-out';
import { cubicIn } from './cubic-in';
import { cubicOut } from './cubic-out';
import { elasticInOut } from './elastic-in-out';
import { elasticIn } from './elastic-in';
import { elasticOut } from './elastic-out';
import { expoInOut } from './expo-in-out';
import { expoIn } from './expo-in';
import { expoOut } from './expo-out';
import { linear } from './linear';
import { quadInOut } from './quad-in-out';
import { quadIn } from './quad-in';
import { quadOut } from './quad-out';
import { quartInOut } from './quart-in-out';
import { quartIn } from './quart-in';
import { quartOut } from './quart-out';
import { quintInOut } from './quint-in-out';
import { quintIn } from './quint-in';
import { quintOut } from './quint-out';
import { sineInOut } from './sine-in-out';
import { sineIn } from './sine-in';
import { sineOut } from './sine-out';
All easing functions only remap a time value, and all have the same signature.
v = ease(t)
Where t
is typically a value between 0 and 1, and it returns a new float that has been eased.
License
MIT, see LICENSE.md for details.