mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-04 17:09:46 +08:00
a106459dd1
* feat: support Keyframes as 'animationName' value * feat: add zoom animation * chore: code clean * test: fix anim * chore: move file * chore: dep clean
145 lines
2.8 KiB
TypeScript
145 lines
2.8 KiB
TypeScript
import { CSSInterpolation, Keyframes } from '@ant-design/cssinjs';
|
|
import type { DerivativeToken } from '../../_util/theme';
|
|
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 [
|
|
initMotion(rootMotionName, inKeyframes, outKeyframes, token.motionDurationMid),
|
|
|
|
{
|
|
[`
|
|
${motionCls}-enter,
|
|
${motionCls}-appear
|
|
`]: {
|
|
opacity: 0,
|
|
animationTimingFunction: token.motionEaseOutQuint,
|
|
},
|
|
|
|
[`${motionCls}-leave`]: {
|
|
animationTimingFunction: token.motionEaseInQuint,
|
|
},
|
|
},
|
|
];
|
|
};
|
|
|
|
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,
|
|
},
|
|
});
|