123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- import { Keyframes } from '@ant-design/cssinjs';
- import { initMotion } from './motion';
- export const moveDownIn = new Keyframes('antMoveDownIn', {
- '0%': {
- transform: 'translate3d(0, 100%, 0)',
- transformOrigin: '0 0',
- opacity: 0
- },
- '100%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- }
- });
- export const moveDownOut = new Keyframes('antMoveDownOut', {
- '0%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- },
- '100%': {
- transform: 'translate3d(0, 100%, 0)',
- transformOrigin: '0 0',
- opacity: 0
- }
- });
- export const moveLeftIn = new Keyframes('antMoveLeftIn', {
- '0%': {
- transform: 'translate3d(-100%, 0, 0)',
- transformOrigin: '0 0',
- opacity: 0
- },
- '100%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- }
- });
- export const moveLeftOut = new Keyframes('antMoveLeftOut', {
- '0%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- },
- '100%': {
- transform: 'translate3d(-100%, 0, 0)',
- transformOrigin: '0 0',
- opacity: 0
- }
- });
- export const moveRightIn = new Keyframes('antMoveRightIn', {
- '0%': {
- transform: 'translate3d(100%, 0, 0)',
- transformOrigin: '0 0',
- opacity: 0
- },
- '100%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- }
- });
- export const moveRightOut = new Keyframes('antMoveRightOut', {
- '0%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- },
- '100%': {
- transform: 'translate3d(100%, 0, 0)',
- transformOrigin: '0 0',
- opacity: 0
- }
- });
- export const moveUpIn = new Keyframes('antMoveUpIn', {
- '0%': {
- transform: 'translate3d(0, -100%, 0)',
- transformOrigin: '0 0',
- opacity: 0
- },
- '100%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- }
- });
- export const moveUpOut = new Keyframes('antMoveUpOut', {
- '0%': {
- transform: 'translate3d(0, 0, 0)',
- transformOrigin: '0 0',
- opacity: 1
- },
- '100%': {
- transform: 'translate3d(0, -100%, 0)',
- transformOrigin: '0 0',
- opacity: 0
- }
- });
- const moveMotion = {
- 'move-up': {
- inKeyframes: moveUpIn,
- outKeyframes: moveUpOut
- },
- 'move-down': {
- inKeyframes: moveDownIn,
- outKeyframes: moveDownOut
- },
- 'move-left': {
- inKeyframes: moveLeftIn,
- outKeyframes: moveLeftOut
- },
- 'move-right': {
- inKeyframes: moveRightIn,
- outKeyframes: moveRightOut
- }
- };
- export const initMoveMotion = (token, motionName) => {
- const {
- antCls
- } = token;
- const motionCls = `${antCls}-${motionName}`;
- const {
- inKeyframes,
- outKeyframes
- } = moveMotion[motionName];
- return [initMotion(motionCls, inKeyframes, outKeyframes, token.motionDurationMid), {
- [`
- ${motionCls}-enter,
- ${motionCls}-appear
- `]: {
- opacity: 0,
- animationTimingFunction: token.motionEaseOutCirc
- },
- [`${motionCls}-leave`]: {
- animationTimingFunction: token.motionEaseInOutCirc
- }
- }];
- };
|