fade.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.initFadeMotion = exports.fadeOut = exports.fadeIn = void 0;
  6. var _cssinjs = require("@ant-design/cssinjs");
  7. var _motion = require("./motion");
  8. const fadeIn = exports.fadeIn = new _cssinjs.Keyframes('antFadeIn', {
  9. '0%': {
  10. opacity: 0
  11. },
  12. '100%': {
  13. opacity: 1
  14. }
  15. });
  16. const fadeOut = exports.fadeOut = new _cssinjs.Keyframes('antFadeOut', {
  17. '0%': {
  18. opacity: 1
  19. },
  20. '100%': {
  21. opacity: 0
  22. }
  23. });
  24. const initFadeMotion = (token, sameLevel = false) => {
  25. const {
  26. antCls
  27. } = token;
  28. const motionCls = `${antCls}-fade`;
  29. const sameLevelPrefix = sameLevel ? '&' : '';
  30. return [(0, _motion.initMotion)(motionCls, fadeIn, fadeOut, token.motionDurationMid, sameLevel), {
  31. [`
  32. ${sameLevelPrefix}${motionCls}-enter,
  33. ${sameLevelPrefix}${motionCls}-appear
  34. `]: {
  35. opacity: 0,
  36. animationTimingFunction: 'linear'
  37. },
  38. [`${sameLevelPrefix}${motionCls}-leave`]: {
  39. animationTimingFunction: 'linear'
  40. }
  41. }];
  42. };
  43. exports.initFadeMotion = initFadeMotion;