123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184 |
- import { Keyframes } from '@ant-design/cssinjs';
- import { initMotion } from './motion';
- export const zoomIn = new Keyframes('antZoomIn', {
- '0%': {
- transform: 'scale(0.2)',
- opacity: 0
- },
- '100%': {
- transform: 'scale(1)',
- opacity: 1
- }
- });
- export const zoomOut = new Keyframes('antZoomOut', {
- '0%': {
- transform: 'scale(1)'
- },
- '100%': {
- transform: 'scale(0.2)',
- opacity: 0
- }
- });
- export const zoomBigIn = new Keyframes('antZoomBigIn', {
- '0%': {
- transform: 'scale(0.8)',
- opacity: 0
- },
- '100%': {
- transform: 'scale(1)',
- opacity: 1
- }
- });
- export const zoomBigOut = new Keyframes('antZoomBigOut', {
- '0%': {
- transform: 'scale(1)'
- },
- '100%': {
- transform: 'scale(0.8)',
- opacity: 0
- }
- });
- export const zoomUpIn = new Keyframes('antZoomUpIn', {
- '0%': {
- transform: 'scale(0.8)',
- transformOrigin: '50% 0%',
- opacity: 0
- },
- '100%': {
- transform: 'scale(1)',
- transformOrigin: '50% 0%'
- }
- });
- export const zoomUpOut = new Keyframes('antZoomUpOut', {
- '0%': {
- transform: 'scale(1)',
- transformOrigin: '50% 0%'
- },
- '100%': {
- transform: 'scale(0.8)',
- transformOrigin: '50% 0%',
- opacity: 0
- }
- });
- export const zoomLeftIn = new Keyframes('antZoomLeftIn', {
- '0%': {
- transform: 'scale(0.8)',
- transformOrigin: '0% 50%',
- opacity: 0
- },
- '100%': {
- transform: 'scale(1)',
- transformOrigin: '0% 50%'
- }
- });
- export const zoomLeftOut = new Keyframes('antZoomLeftOut', {
- '0%': {
- transform: 'scale(1)',
- transformOrigin: '0% 50%'
- },
- '100%': {
- transform: 'scale(0.8)',
- transformOrigin: '0% 50%',
- opacity: 0
- }
- });
- export const zoomRightIn = new Keyframes('antZoomRightIn', {
- '0%': {
- transform: 'scale(0.8)',
- transformOrigin: '100% 50%',
- opacity: 0
- },
- '100%': {
- transform: 'scale(1)',
- transformOrigin: '100% 50%'
- }
- });
- export const zoomRightOut = new Keyframes('antZoomRightOut', {
- '0%': {
- transform: 'scale(1)',
- transformOrigin: '100% 50%'
- },
- '100%': {
- transform: 'scale(0.8)',
- transformOrigin: '100% 50%',
- opacity: 0
- }
- });
- export const zoomDownIn = new Keyframes('antZoomDownIn', {
- '0%': {
- transform: 'scale(0.8)',
- transformOrigin: '50% 100%',
- opacity: 0
- },
- '100%': {
- transform: 'scale(1)',
- transformOrigin: '50% 100%'
- }
- });
- export const zoomDownOut = new Keyframes('antZoomDownOut', {
- '0%': {
- transform: 'scale(1)',
- transformOrigin: '50% 100%'
- },
- '100%': {
- transform: 'scale(0.8)',
- transformOrigin: '50% 100%',
- opacity: 0
- }
- });
- const zoomMotion = {
- zoom: {
- inKeyframes: zoomIn,
- outKeyframes: zoomOut
- },
- 'zoom-big': {
- inKeyframes: zoomBigIn,
- outKeyframes: zoomBigOut
- },
- 'zoom-big-fast': {
- inKeyframes: zoomBigIn,
- outKeyframes: zoomBigOut
- },
- 'zoom-left': {
- inKeyframes: zoomLeftIn,
- outKeyframes: zoomLeftOut
- },
- 'zoom-right': {
- inKeyframes: zoomRightIn,
- outKeyframes: zoomRightOut
- },
- 'zoom-up': {
- inKeyframes: zoomUpIn,
- outKeyframes: zoomUpOut
- },
- 'zoom-down': {
- inKeyframes: zoomDownIn,
- outKeyframes: zoomDownOut
- }
- };
- export const initZoomMotion = (token, motionName) => {
- const {
- antCls
- } = token;
- const motionCls = `${antCls}-${motionName}`;
- const {
- inKeyframes,
- outKeyframes
- } = zoomMotion[motionName];
- return [initMotion(motionCls, inKeyframes, outKeyframes, motionName === 'zoom-big-fast' ? token.motionDurationFast : token.motionDurationMid), {
- [`
- ${motionCls}-enter,
- ${motionCls}-appear
- `]: {
- transform: 'scale(0)',
- opacity: 0,
- animationTimingFunction: token.motionEaseOutCirc,
- '&-prepare': {
- transform: 'none'
- }
- },
- [`${motionCls}-leave`]: {
- animationTimingFunction: token.motionEaseInOutCirc
- }
- }];
- };
|