2022-03-08 10:29:00 +08:00
|
|
|
import { CSSInterpolation, Keyframes } from '@ant-design/cssinjs';
|
2022-04-21 17:28:02 +08:00
|
|
|
import type { DerivativeToken } from '../../_util/theme';
|
2022-03-08 10:29:00 +08:00
|
|
|
import { initMotion } from './motion';
|
|
|
|
|
|
|
|
export const initSlideMotion = (
|
|
|
|
rootPrefixCls: string,
|
|
|
|
motionName: string,
|
|
|
|
inKeyframes: Keyframes,
|
|
|
|
outKeyframes: Keyframes,
|
|
|
|
token: DerivativeToken,
|
|
|
|
): CSSInterpolation => {
|
|
|
|
const rootMotionName = `${rootPrefixCls}-${motionName}`;
|
|
|
|
const motionCls = `.${rootMotionName}`;
|
|
|
|
|
|
|
|
return [
|
2022-04-21 02:06:22 +08:00
|
|
|
initMotion(rootMotionName, inKeyframes, outKeyframes, token.motionDurationMid),
|
2022-03-08 10:29:00 +08:00
|
|
|
|
|
|
|
{
|
|
|
|
[`
|
|
|
|
${motionCls}-enter,
|
|
|
|
${motionCls}-appear
|
|
|
|
`]: {
|
|
|
|
opacity: 0,
|
2022-03-22 09:37:37 +08:00
|
|
|
animationTimingFunction: token.motionEaseOutQuint,
|
2022-03-08 10:29:00 +08:00
|
|
|
},
|
|
|
|
|
|
|
|
[`${motionCls}-leave`]: {
|
2022-03-22 09:37:37 +08:00
|
|
|
animationTimingFunction: token.motionEaseInQuint,
|
2022-03-08 10:29:00 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
export const slideUpIn = new Keyframes('antSlideUpIn', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleY(0.8)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleY(1)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const slideUpOut = new Keyframes('antSlideUpOut', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleY(1)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleY(0.8)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const slideDownIn = new Keyframes('antSlideDownIn', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleY(0.8)',
|
|
|
|
transformOrigin: '100% 100%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleY(1)',
|
|
|
|
transformOrigin: '100% 100%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const slideDownOut = new Keyframes('antSlideDownOut', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleY(1)',
|
|
|
|
transformOrigin: '100% 100%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleY(0.8)',
|
|
|
|
transformOrigin: '100% 100%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const slideLeftIn = new Keyframes('antSlideLeftIn', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleX(0.8)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleX(1)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const slideLeftOut = new Keyframes('antSlideLeftOut', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleX(1)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleX(0.8)',
|
|
|
|
transformOrigin: '0% 0%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const slideRightIn = new Keyframes('antSlideRightIn', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleX(0.8)',
|
|
|
|
transformOrigin: '100% 0%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleX(1)',
|
|
|
|
transformOrigin: '100% 0%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
export const slideRightOut = new Keyframes('antSlideRightOut', {
|
|
|
|
'0%': {
|
|
|
|
transform: 'scaleX(1)',
|
|
|
|
transformOrigin: '100% 0%',
|
|
|
|
opacity: 1,
|
|
|
|
},
|
|
|
|
|
|
|
|
'100%': {
|
|
|
|
transform: 'scaleX(0.8)',
|
|
|
|
transformOrigin: '100% 0%',
|
|
|
|
opacity: 0,
|
|
|
|
},
|
|
|
|
});
|