fade.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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("../../_util/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 = function (token) {
  25. let sameLevel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  26. const {
  27. antCls
  28. } = token;
  29. const motionCls = `${antCls}-fade`;
  30. const sameLevelPrefix = sameLevel ? '&' : '';
  31. return [(0, _motion.initMotion)(motionCls, fadeIn, fadeOut, token.motionDurationMid, sameLevel), {
  32. [`
  33. ${sameLevelPrefix}${motionCls}-enter,
  34. ${sameLevelPrefix}${motionCls}-appear
  35. `]: {
  36. opacity: 0,
  37. animationTimingFunction: 'linear'
  38. },
  39. [`${sameLevelPrefix}${motionCls}-leave`]: {
  40. animationTimingFunction: 'linear'
  41. }
  42. }];
  43. };
  44. exports.initFadeMotion = initFadeMotion;