-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from JongMany/feature/main
feature: 스크롤 애니메이션 구현
- Loading branch information
Showing
4 changed files
with
72 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useInView } from "framer-motion"; | ||
import React, { useRef } from "react"; | ||
|
||
export default function MyProfile() { | ||
const ref = useRef<HTMLDivElement>(null); | ||
const isInView = useInView(ref, { margin: "10px" }); | ||
|
||
return ( | ||
<article | ||
ref={ref} | ||
style={{ | ||
transform: isInView ? "none" : `translateY(${isInView ? 0 : 200}px)`, | ||
opacity: isInView ? 1 : 0, | ||
transition: `all 0.5s cubic-bezier(0.17, 0.55, 0.55, 1) 0.5s`, | ||
}} | ||
> | ||
<div></div> | ||
<div> | ||
<h1>안녕하세요</h1> | ||
</div> | ||
</article> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters