UNPKG

2.42 kBJavaScriptView Raw
1"use strict";
2
3exports.__esModule = true;
4exports["default"] = timingFunctions;
5/* eslint-disable key-spacing */
6var functionsMap = {
7 easeInBack: 'cubic-bezier(0.600, -0.280, 0.735, 0.045)',
8 easeInCirc: 'cubic-bezier(0.600, 0.040, 0.980, 0.335)',
9 easeInCubic: 'cubic-bezier(0.550, 0.055, 0.675, 0.190)',
10 easeInExpo: 'cubic-bezier(0.950, 0.050, 0.795, 0.035)',
11 easeInQuad: 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
12 easeInQuart: 'cubic-bezier(0.895, 0.030, 0.685, 0.220)',
13 easeInQuint: 'cubic-bezier(0.755, 0.050, 0.855, 0.060)',
14 easeInSine: 'cubic-bezier(0.470, 0.000, 0.745, 0.715)',
15 easeOutBack: 'cubic-bezier(0.175, 0.885, 0.320, 1.275)',
16 easeOutCubic: 'cubic-bezier(0.215, 0.610, 0.355, 1.000)',
17 easeOutCirc: 'cubic-bezier(0.075, 0.820, 0.165, 1.000)',
18 easeOutExpo: 'cubic-bezier(0.190, 1.000, 0.220, 1.000)',
19 easeOutQuad: 'cubic-bezier(0.250, 0.460, 0.450, 0.940)',
20 easeOutQuart: 'cubic-bezier(0.165, 0.840, 0.440, 1.000)',
21 easeOutQuint: 'cubic-bezier(0.230, 1.000, 0.320, 1.000)',
22 easeOutSine: 'cubic-bezier(0.390, 0.575, 0.565, 1.000)',
23 easeInOutBack: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)',
24 easeInOutCirc: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)',
25 easeInOutCubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
26 easeInOutExpo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)',
27 easeInOutQuad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
28 easeInOutQuart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)',
29 easeInOutQuint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)',
30 easeInOutSine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)'
31};
32/* eslint-enable key-spacing */
33
34function getTimingFunction(functionName) {
35 return functionsMap[functionName];
36}
37
38/**
39 * String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).
40 *
41 * @deprecated - This will be deprecated in v5 in favor of `easeIn`, `easeOut`, `easeInOut`.
42 *
43 * @example
44 * // Styles as object usage
45 * const styles = {
46 * 'transitionTimingFunction': timingFunctions('easeInQuad')
47 * }
48 *
49 * // styled-components usage
50 * const div = styled.div`
51 * transitionTimingFunction: ${timingFunctions('easeInQuad')};
52 * `
53 *
54 * // CSS as JS Output
55 *
56 * 'div': {
57 * 'transitionTimingFunction': 'cubic-bezier(0.550, 0.085, 0.680, 0.530)',
58 * }
59 */
60
61function timingFunctions(timingFunction) {
62 return getTimingFunction(timingFunction);
63}
64module.exports = exports.default;
\No newline at end of file