ant-design/components/style/motion/fade.tsx
MadCcc 9f2f9bb57f
refactor: default theme with algorithm (#36175)
* refactor: alias token

* refactor: use palettes

* refactor: default theme

* chore: code clean

* refactor: component token

* feat: light tokens

* feat: add dark theme

* feat: dark derivative

* chore: code clean

* refactor: fix colorBgContainer

* refactor: rename token

* test: fix lint

* chore: code clean

* chore: code clen

* refactor: badge shadow color

* test: add test case
2022-06-24 11:11:42 +08:00

46 lines
1.0 KiB
TypeScript

import type { CSSInterpolation } from '@ant-design/cssinjs';
import { Keyframes } from '@ant-design/cssinjs';
import type { AliasToken } from '../../_util/theme';
import type { TokenWithCommonCls } from '../../_util/theme/util/genComponentStyleHook';
import { initMotion } from './motion';
export const fadeIn = new Keyframes('antFadeIn', {
'0%': {
opacity: 0,
},
'100%': {
opacity: 1,
},
});
export const fadeOut = new Keyframes('antFadeOut', {
'0%': {
opacity: 1,
},
'100%': {
opacity: 0,
},
});
export const initFadeMotion = (token: TokenWithCommonCls<AliasToken>): CSSInterpolation => {
const { antCls } = token;
const motionCls = `${antCls}-fade`;
return [
initMotion(motionCls, fadeIn, fadeOut, token.motionDurationMid),
{
[`
${motionCls}-enter,
${motionCls}-appear
`]: {
opacity: 0,
animationTimingFunction: 'linear',
},
[`${motionCls}-leave`]: {
animationTimingFunction: 'linear',
},
},
];
};