CubicBezierPresets.js 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  5. */
  6. // Set of preset definitions for use with CubicBezierWidget
  7. // Credit: http://easings.net
  8. "use strict";
  9. const PREDEFINED = {
  10. "ease": [0.25, 0.1, 0.25, 1],
  11. "linear": [0, 0, 1, 1],
  12. "ease-in": [0.42, 0, 1, 1],
  13. "ease-out": [0, 0, 0.58, 1],
  14. "ease-in-out": [0.42, 0, 0.58, 1]
  15. };
  16. const PRESETS = {
  17. "ease-in": {
  18. "ease-in-linear": [0, 0, 1, 1],
  19. "ease-in-ease-in": [0.42, 0, 1, 1],
  20. "ease-in-sine": [0.47, 0, 0.74, 0.71],
  21. "ease-in-quadratic": [0.55, 0.09, 0.68, 0.53],
  22. "ease-in-cubic": [0.55, 0.06, 0.68, 0.19],
  23. "ease-in-quartic": [0.9, 0.03, 0.69, 0.22],
  24. "ease-in-quintic": [0.76, 0.05, 0.86, 0.06],
  25. "ease-in-exponential": [0.95, 0.05, 0.8, 0.04],
  26. "ease-in-circular": [0.6, 0.04, 0.98, 0.34],
  27. "ease-in-backward": [0.6, -0.28, 0.74, 0.05]
  28. },
  29. "ease-out": {
  30. "ease-out-linear": [0, 0, 1, 1],
  31. "ease-out-ease-out": [0, 0, 0.58, 1],
  32. "ease-out-sine": [0.39, 0.58, 0.57, 1],
  33. "ease-out-quadratic": [0.25, 0.46, 0.45, 0.94],
  34. "ease-out-cubic": [0.22, 0.61, 0.36, 1],
  35. "ease-out-quartic": [0.17, 0.84, 0.44, 1],
  36. "ease-out-quintic": [0.23, 1, 0.32, 1],
  37. "ease-out-exponential": [0.19, 1, 0.22, 1],
  38. "ease-out-circular": [0.08, 0.82, 0.17, 1],
  39. "ease-out-backward": [0.18, 0.89, 0.32, 1.28]
  40. },
  41. "ease-in-out": {
  42. "ease-in-out-linear": [0, 0, 1, 1],
  43. "ease-in-out-ease": [0.25, 0.1, 0.25, 1],
  44. "ease-in-out-ease-in-out": [0.42, 0, 0.58, 1],
  45. "ease-in-out-sine": [0.45, 0.05, 0.55, 0.95],
  46. "ease-in-out-quadratic": [0.46, 0.03, 0.52, 0.96],
  47. "ease-in-out-cubic": [0.65, 0.05, 0.36, 1],
  48. "ease-in-out-quartic": [0.77, 0, 0.18, 1],
  49. "ease-in-out-quintic": [0.86, 0, 0.07, 1],
  50. "ease-in-out-exponential": [1, 0, 0, 1],
  51. "ease-in-out-circular": [0.79, 0.14, 0.15, 0.86],
  52. "ease-in-out-backward": [0.68, -0.55, 0.27, 1.55]
  53. }
  54. };
  55. const DEFAULT_PRESET_CATEGORY = Object.keys(PRESETS)[0];
  56. exports.PRESETS = PRESETS;
  57. exports.PREDEFINED = PREDEFINED;
  58. exports.DEFAULT_PRESET_CATEGORY = DEFAULT_PRESET_CATEGORY;