mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-16 01:41:02 +08:00
1bcfe0cce3
* fix: modal motion * fix: image motion * refactor: popover & tooltip motion * chore: code clean * refactor: move motion * refactor * chore: code clean * refactor: dropdown support move motion
48 lines
1.2 KiB
TypeScript
48 lines
1.2 KiB
TypeScript
/* eslint-disable import/prefer-default-export */
|
|
import type { 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 = (
|
|
motionCls: string,
|
|
inKeyframes: Keyframes,
|
|
outKeyframes: Keyframes,
|
|
duration: string,
|
|
): CSSObject => ({
|
|
[`
|
|
${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,
|
|
animationPlayState: 'running',
|
|
},
|
|
|
|
[`${motionCls}-leave${motionCls}-leave-active`]: {
|
|
animationName: outKeyframes,
|
|
animationPlayState: 'running',
|
|
pointerEvents: 'none',
|
|
},
|
|
});
|