-
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.
180 fix coloredSection opacity, style globe on frontpage (#188)
* feat(frontend): change coloredSection opacity, and hero pading * feat(frontend): 🎨 create new example framer motion animated divs * position globe in grid and resize it automatically
- Loading branch information
Magnus Alexander Strømseng
authored and
GitHub
committed
Apr 2, 2024
1 parent
5b0245a
commit 5158e6f
Showing
6 changed files
with
125 additions
and
36 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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,59 @@ | ||
| "use client"; | ||
| import { motion, useScroll } from "framer-motion"; | ||
| import { useRef } from "react"; | ||
| import React from "react"; | ||
| function ScrollLinkedDiv({ | ||
| transformOrigin = "left", | ||
| }: { | ||
| transformOrigin?: string; | ||
| }) { | ||
| const ref = useRef(null); | ||
| const { scrollYProgress } = useScroll({ | ||
| target: ref, | ||
| offset: ["end end", "start start"], | ||
| }); | ||
|
|
||
| return ( | ||
| <motion.div | ||
| className="h-[1px] place-self-start self-start bg-white bg-opacity-50" | ||
| style={{ | ||
| scaleX: scrollYProgress, | ||
| transformOrigin: transformOrigin, | ||
| }} | ||
| initial={{ scaleX: 0 }} | ||
| ref={ref} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| function WindowScrollLinkedDiv({ children }: { children?: React.ReactNode }) { | ||
| const ref = useRef(null); | ||
| const { scrollYProgress } = useScroll({ | ||
| target: ref, | ||
| offset: ["end end", "start start"], | ||
| }); | ||
| return ( | ||
| <> | ||
| <motion.div | ||
| className="h-[1px] place-self-start self-start bg-white bg-opacity-50" | ||
| style={{ | ||
| scaleX: scrollYProgress, | ||
| transformOrigin: "left", | ||
| }} | ||
| initial={{ scaleX: 0 }} | ||
| ref={ref} | ||
| /> | ||
| {children} | ||
| <motion.div | ||
| className="h-[1px] place-self-start self-start bg-white bg-opacity-50" | ||
| style={{ | ||
| scaleX: scrollYProgress, | ||
| transformOrigin: "right", | ||
| }} | ||
| initial={{ scaleX: 0 }} | ||
| /> | ||
| </> | ||
| ); | ||
| } | ||
|
|
||
| export { ScrollLinkedDiv, WindowScrollLinkedDiv }; |