easeInOut.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. "use strict";
  2. exports.__esModule = true;
  3. exports["default"] = easeInOut;
  4. var functionsMap = {
  5. back: 'cubic-bezier(0.680, -0.550, 0.265, 1.550)',
  6. circ: 'cubic-bezier(0.785, 0.135, 0.150, 0.860)',
  7. cubic: 'cubic-bezier(0.645, 0.045, 0.355, 1.000)',
  8. expo: 'cubic-bezier(1.000, 0.000, 0.000, 1.000)',
  9. quad: 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
  10. quart: 'cubic-bezier(0.770, 0.000, 0.175, 1.000)',
  11. quint: 'cubic-bezier(0.860, 0.000, 0.070, 1.000)',
  12. sine: 'cubic-bezier(0.445, 0.050, 0.550, 0.950)'
  13. };
  14. /**
  15. * String to represent common easing functions as demonstrated here: (github.com/jaukia/easie).
  16. *
  17. * @example
  18. * // Styles as object usage
  19. * const styles = {
  20. * 'transitionTimingFunction': easeInOut('quad')
  21. * }
  22. *
  23. * // styled-components usage
  24. * const div = styled.div`
  25. * transitionTimingFunction: ${easeInOut('quad')};
  26. * `
  27. *
  28. * // CSS as JS Output
  29. *
  30. * 'div': {
  31. * 'transitionTimingFunction': 'cubic-bezier(0.455, 0.030, 0.515, 0.955)',
  32. * }
  33. */
  34. function easeInOut(functionName) {
  35. return functionsMap[functionName.toLowerCase().trim()];
  36. }
  37. module.exports = exports.default;