Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 20x 20x 3x 3x 20x | import React from "react"; import { CSSTransition } from "react-transition-group"; import { TransitionProps } from "react-transition-group/Transition"; import { scale } from "../_util/transition"; export interface ScaleTransitionProps extends Partial<TransitionProps> { /** * 从哪个缩放系数进场,默认为 0.5 */ from?: number; /** * 从哪个缩放系数离场,默认与 from 一致 */ to?: number; /** * 缩放原点 */ origin?: string; } export function ScaleTransition({ from, to, timeout, origin, ...rest }: ScaleTransitionProps) { let enterTimeout: number; let exitTimeout: number; Iif (typeof timeout === "number") { enterTimeout = timeout; exitTimeout = timeout; } else if (timeout && typeof timeout === "object") { enterTimeout = timeout.enter; exitTimeout = timeout.exit; } return ( <CSSTransition {...scale(from, to, enterTimeout, exitTimeout, origin)} {...rest} /> ); } |