UNPKG

1.12 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = easeInOut;
5var functionsMap = {
6 back: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)',
7 circ: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)',
8 cubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
9 expo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)',
10 quad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
11 quart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)',
12 quint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)',
13 sine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)'
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': easeInOut('quad')
23 * }
24 *
25 * // styled-components usage
26 * const div = styled.div`
27 * transitionTimingFunction: ${easeInOut('quad')};
28 * `
29 *
30 * // CSS as JS Output
31 *
32 * 'div': {
33 * 'transitionTimingFunction': 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
34 * }
35 */
36function easeInOut(functionName) {
37 return functionsMap[functionName.toLowerCase().trim()];
38}
39module.exports = exports.default;
\No newline at end of file