We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
react 18.2 只有enter到leave的动画 没有from到enter的动画 新手望指点
import { Button } from "antd"; import { useSwitchTransition } from "transition-hook"; export default function Test() { const [count, setCount] = useState(0); const transition = useSwitchTransition(count, 300, "default"); return ( <div className="BasicSwitchTransition"> <div style={{ display: "flex", justifyContent: "center", alignItems: "center", gap: 40, marginTop: 50, }} > <Button onClick={() => setCount(count - 1)}>-1</Button> <div style={{ width: 150, display: "grid", placeItems: "center", perspective: 200, }} > {transition((state, stage) => ( <h1 style={{ fontSize: "5em", position: "absolute", transition: ".3s", opacity: stage === "enter" ? 1 : 0, transform: { from: "translateY(-100%) rotateX(60deg) scale(.5)", enter: "translateY(0%)", leave: "translateY(100%) rotateX(-60deg) scale(.5)", }[stage], }} > {state} </h1> ))} </div> <Button onClick={() => setCount(count + 1)}>+1</Button> </div> <div style={{ display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column", gap: 40, marginTop: 100, }} > <Button onClick={() => setCount(count - 1)}>-1</Button> <div style={{ width: 150, display: "grid", placeItems: "center", perspective: 200, }} > {transition((state, stage) => ( <h1 style={{ fontSize: "2em", position: "absolute", transition: ".3s", opacity: stage === "enter" ? 1 : 0, transform: { from: "translateX(-100%) rotateY(-60deg) scale(.5)", enter: "translateX(0%)", leave: "translateX(100%) rotateY(60deg) scale(.5)", }[stage], }} > {state} </h1> ))} </div> <Button onClick={() => setCount(count + 1)}>+1</Button> </div> </div> ); }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
react 18.2 只有enter到leave的动画 没有from到enter的动画 新手望指点
The text was updated successfully, but these errors were encountered: