mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-15 17:19:11 +08:00
068584b76c
* chore: init * chore: init single * chore: merge next * chore: select single base * chore: basic all style of select * chore: speed of dropdown * chore: move size in single * chore: single size * chore: lg style * chore: left & right * chore: rtl * chore: auto rtl * chore: rtl * fix: height cal * chore: clean up * chore: status color
53 lines
1.3 KiB
TypeScript
53 lines
1.3 KiB
TypeScript
/* eslint-disable import/prefer-default-export */
|
|
import { CSSObject, Keyframes } from '@ant-design/cssinjs';
|
|
|
|
const initMotionCommon = (duration: string): CSSObject => ({
|
|
animationDuration: duration,
|
|
animationFillMode: 'both',
|
|
});
|
|
|
|
// FIXME: origin less code seems same as initMotionCommon. Maybe we can safe remove
|
|
const initMotionCommonLeave = (duration: string): CSSObject => ({
|
|
animationDuration: duration,
|
|
animationFillMode: 'both',
|
|
});
|
|
|
|
export const initMotion = (
|
|
hashId: string,
|
|
motionName: string,
|
|
inKeyframes: Keyframes,
|
|
outKeyframes: Keyframes,
|
|
duration: string,
|
|
): CSSObject => {
|
|
const motionCls = `.${motionName}`;
|
|
|
|
return {
|
|
[`
|
|
${motionCls}-enter,
|
|
${motionCls}-appear
|
|
`]: {
|
|
...initMotionCommon(duration),
|
|
animationPlayState: 'paused',
|
|
},
|
|
|
|
[`${motionCls}-leave`]: {
|
|
...initMotionCommonLeave(duration),
|
|
animationPlayState: 'paused',
|
|
},
|
|
|
|
[`
|
|
${motionCls}-enter${motionCls}-enter-active,
|
|
${motionCls}-appear${motionCls}-appear-active
|
|
`]: {
|
|
animationName: inKeyframes.getName(hashId),
|
|
animationPlayState: 'running',
|
|
},
|
|
|
|
[`${motionCls}-leave${motionCls}-leave-active`]: {
|
|
animationName: outKeyframes.getName(hashId),
|
|
animationPlayState: 'running',
|
|
pointerEvents: 'none',
|
|
},
|
|
};
|
|
};
|