UNPKG

1.11 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = easeIn;
5var functionsMap = {
6 back: 'cubic-bezier(0.600, -0.280, 0.735, 0.045)',
7 circ: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)',
8 cubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
9 expo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)',
10 quad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
11 quart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)',
12 quint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)',
13 sine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)'
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': easeIn('quad')
23 * }
24 *
25 * // styled-components usage
26 * const div = styled.div`
27 * transitionTimingFunction: ${easeIn('quad')};
28 * `
29 *
30 * // CSS as JS Output
31 *
32 * 'div': {
33 * 'transitionTimingFunction': 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
34 * }
35 */
36function easeIn(functionName) {
37 return functionsMap[functionName.toLowerCase().trim()];
38}
39module.exports = exports.default;
\No newline at end of file