UNPKG

1.11 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = easeOut;
5var functionsMap = {
6 back: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)',
7 cubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
8 circ: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)',
9 expo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)',
10 quad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
11 quart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
12 quint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)',
13 sine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)'
14};
15
16/**
17 * String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).
18 *
19 * @example
20 * // Styles as object usage
21 * const styles = {
22 * 'transitionTimingFunction': easeOut('quad')
23 * }
24 *
25 * // styled-components usage
26 * const div = styled.div`
27 * transitionTimingFunction: ${easeOut('quad')};
28 * `
29 *
30 * // CSS as JS Output
31 *
32 * 'div': {
33 * 'transitionTimingFunction': 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
34 * }
35 */
36function easeOut(functionName) {
37 return functionsMap[functionName.toLowerCase().trim()];
38}
39module.exports = exports.default;
\No newline at end of file