728x90
yarn add react-scroll-motion
import { Animator, ScrollContainer, ScrollPage, batch, Fade, FadeIn, Move, MoveIn, MoveOut, Sticky, StickyIn, ZoomIn } from "react-scroll-motion";
const ZoomInScrollOut = batch(StickyIn(), FadeIn(), ZoomIn());
const FadeUp = batch(Fade(), Move(), Sticky());
<ScrollContainer>
{/* 기본 */}
<ScrollPage page={0}>
<Animator animation={batch(Fade(), Sticky(), MoveOut(0, -200))}>
<span style={{ fontSize: "30px" }}>Let me show you scroll animation 😀</span>
</Animator>
</ScrollPage>
{/* 줌인->줌아웃 */}
<ScrollPage page={1}>
<Animator animation={ZoomInScrollOut}>
<span style={{ fontSize: "40px" }}>I'm FadeUpScrollOut ✨</span>
</Animator>
</ScrollPage>
{/* 페이드업 */}
<ScrollPage page={2}>
<Animator animation={FadeUp}>
<span style={{ fontSize: "40px" }}>I'm FadeUp ⛅️</span>
</Animator>
</ScrollPage>
{/* 크로스 업 */}
<ScrollPage page={3}>
<div style={{ display: "flex", justifyContent: "center", alignItems: "center", height: "100%" }} >
<span style={{ fontSize: "40px" }}>
<Animator animation={MoveIn(-1000, 0)}>Hello Guys 👋🏻</Animator>
<Animator animation={MoveIn(1000, 0)}>Nice to meet you 🙋🏻♀️</Animator>- I'm Seonghyeok -
<Animator animation={MoveOut(1000, 0)}>Good bye ✋🏻</Animator>
<Animator animation={MoveOut(-1000, 0)}>See you 💛</Animator>
</span>
</div>
</ScrollPage>
{/* 끝 */}
<ScrollPage page={4}>
<Animator animation={batch(Fade(), Sticky())}>
<span style={{ fontSize: "40px" }}>Done</span>
<br/>
<span style={{ fontSize: "30px" }}>
There's FadeAnimation, MoveAnimation, StickyAnimation, ZoomAnimation
</span>
</Animator>
</ScrollPage>
</ScrollContainer>
728x90
'Web > React' 카테고리의 다른 글
React Password Progress Bar (0) | 2022.06.02 |
---|---|
React - Hover할때 Other children select (0) | 2022.06.02 |
React - TypeScript: React에서 사용해보기 (0) | 2022.05.31 |
React TypeScript - Interface (0) | 2022.05.31 |
React - TypeScript 기본 - 세팅 ~ 어떻게 타입을 입히는지 (0) | 2022.05.31 |