Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"SSERAFIM",
"SULLYOON",
"Testpage",
"Toastify",
"uuidv",
"WONYOUNG",
"YUJIN",
Expand Down
28 changes: 28 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import Lenis from "@studio-freight/lenis";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { useEffect, useRef } from "react";
import { Route, Routes } from "react-router-dom";
import Toastify from "./components/Toastify";
import { CreditProvider } from "./context/CreditContext";
Expand All @@ -10,6 +14,30 @@ import NotFound from "./pages/NotFound/index.jsx";
import Testpage from "./pages/Testpage/index.jsx";

function App() {
const lenisRef = useRef(null);

// Lenis ์Šคํฌ๋กค ์ดˆ๊ธฐํ™”
useEffect(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์˜คํ™ ๋‚˜์ค‘์— ํŒ๋‹ค๋งˆ์ผ“ ํ•  ๋•Œ๋„ ํ•œ๋ฒˆ ์ ์šฉ์‹œ์ผœ๋ณด๊ณ ์‹ถ๋„ค์šฉ๐Ÿ˜Š๐Ÿ˜Š

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ข‹์Šต๋‹ˆ๋‹ท~ใ…Žใ…Ž

lenisRef.current = new Lenis({
smoothWheel: true,
duration: 1.2,
});

lenisRef.current.on("scroll", ScrollTrigger.update);

const animate = (time) => {
lenisRef.current?.raf(time * 1000);
};

gsap.ticker.add(animate);
gsap.ticker.lagSmoothing(0);

return () => {
gsap.ticker.remove(animate);
lenisRef.current?.destroy();
};
}, []);

return (
<CreditProvider>
<Toastify />
Expand Down
3 changes: 2 additions & 1 deletion src/components/Modal/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ const Modal = ({
</button>
</div>
{/* Modal Content */}
{children}
{/* ๋ชจ๋‹ฌ ์˜คํ”ˆ์‹œ lenis์Šคํฌ๋กค ๋ง‰๋Š” data-lenis-prevent ์†์„ฑ ์ถ”๊ฐ€ */}
<div data-lenis-prevent="true">{children}</div>
</div>
</div>
</ModalPortal>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Landing/components/LandingBottomSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const StyledLandingBottomSection = styled.section`
}
}
@media all and (max-width: 425px) {
height: 133.33vw !important;
height: 520px !important;
.landingGrid {
> img {
width: 65.07vw;
Expand Down
213 changes: 133 additions & 80 deletions src/pages/Landing/components/LandingMiddleSection.jsx
Original file line number Diff line number Diff line change
@@ -1,87 +1,136 @@
import styled from "@emotion/styled";
import { gsap } from "gsap";
import { ScrollTrigger } from "gsap/ScrollTrigger";
import { useEffect } from "react";
import { useEffect, useRef } from "react";

export default function LandingMiddleSection() {
// LandingMiddleSection ์• ๋‹ˆ๋ฉ”์ด์…˜
useEffect(() => {
const ctx = gsap.context(() => {
const anim = gsap.timeline({
scrollTrigger: {
trigger: ".landingMiddleSection",
start: "top top",
end: "+=300%",
pin: true,
scrub: 1,
id: "sec02Trigger",
},
});
const ctx =
window.innerWidth < 768
? gsap.context(() => {
// ๋ชจ๋ฐ”์ผ ๋””๋ฐ”์ด์Šค์—์„œ ๊ฐ article์— ๋Œ€ํ•œ ์• ๋‹ˆ๋ฉ”์ด์…˜
const articles = document.querySelectorAll(
".landingMiddleSection article",
);

gsap.set(".landingMiddleSection article:nth-of-type(2)", {
y: "100%",
});
gsap.set(".landingMiddleSection article:nth-of-type(3)", {
y: "100%",
});
for (const article of articles) {
const fadeInRight = article.querySelector(".fade-in-right");
const fadeInUp = article.querySelectorAll(".fade-in-up");

// ๋„ค๋น„๊ฒŒ์ด์…˜ ์ดˆ๊ธฐ ์„ค์ •
const navButtons = document.querySelectorAll(
".landingMiddleSectionNav button",
);
navButtons[0].classList.add("active");
if (fadeInRight || fadeInUp) {
gsap
.timeline({
scrollTrigger: {
trigger: article,
start: "top 50%",
end: "bottom 50%",
},
})
.fromTo(
fadeInUp,
{
y: 30,
opacity: 0,
},
{
y: 0,
opacity: 1,
duration: 0.5,
},
)
.fromTo(
fadeInRight,
{
x: 100,
opacity: 0,
},
{
x: 0,
opacity: 1,
duration: 0.5,
},
);
}
}
})
: gsap.context(() => {
const anim = gsap.timeline({
scrollTrigger: {
trigger: ".landingMiddleSection",
start: "top top",
end: "+=300%",
pin: true,
scrub: 1,
id: "sec02Trigger",
},
});

// ๋„ค๋น„๊ฒŒ์ด์…˜ ํ™œ์„ฑํ™”
const st = ScrollTrigger.create({
trigger: ".landingMiddleSection",
start: "top top",
end: "+=300%",
onUpdate: (self) => {
const progress = self.progress;
for (const btn of navButtons) {
btn.classList.remove("active");
}
gsap.set(".landingMiddleSection article:nth-of-type(2)", {
y: "100%",
});
gsap.set(".landingMiddleSection article:nth-of-type(3)", {
y: "100%",
});

if (progress < 0.33) {
// ๋„ค๋น„๊ฒŒ์ด์…˜ ์ดˆ๊ธฐ ์„ค์ •
const navButtons = document.querySelectorAll(
".landingMiddleSectionNav button",
);
navButtons[0].classList.add("active");
} else if (progress < 0.66) {
navButtons[1].classList.add("active");
} else {
navButtons[2].classList.add("active");
}
},
});

// ๋„ค๋น„๊ฒŒ์ด์…˜ ํด๋ฆญ ์ด๋ฒคํŠธ
navButtons.forEach((btn, index) => {
btn.addEventListener("click", () => {
const targetProgress = index * 0.5;
const targetScroll = st.start + (st.end - st.start) * targetProgress;
// ๋„ค๋น„๊ฒŒ์ด์…˜ ํ™œ์„ฑํ™”
const st = ScrollTrigger.create({
trigger: ".landingMiddleSection",
start: "top top",
end: "+=300%",
onUpdate: (self) => {
const progress = self.progress;
for (const btn of navButtons) {
btn.classList.remove("active");
}

gsap.to(window, {
scrollTo: targetScroll,
duration: 1,
ease: "power2.inOut",
});
});
});
if (progress < 0.33) {
navButtons[0].classList.add("active");
} else if (progress < 0.66) {
navButtons[1].classList.add("active");
} else {
navButtons[2].classList.add("active");
}
},
});

// ๋„ค๋น„๊ฒŒ์ด์…˜ ํด๋ฆญ ์ด๋ฒคํŠธ
navButtons.forEach((btn, index) => {
btn.addEventListener("click", () => {
const targetProgress = index * 0.5;
const targetScroll =
st.start + (st.end - st.start) * targetProgress;

gsap.to(window, {
scrollTo: targetScroll,
duration: 1,
ease: "power2.inOut",
});
});
});

anim
.to(".landingMiddleSection article:nth-of-type(2)", {
y: 0,
delay: 0.5,
duration: 1,
ease: "power1.inOut",
})
.to(".landingMiddleSection article:nth-of-type(3)", {
y: 0,
duration: 1,
ease: "power1.inOut",
})
.to(".landingMiddleSection", {
delay: 0.2,
});
});
anim
.to(".landingMiddleSection article:nth-of-type(2)", {
y: 0,
delay: 0.5,
duration: 1,
ease: "power1.inOut",
})
.to(".landingMiddleSection article:nth-of-type(3)", {
y: 0,
duration: 1,
ease: "power1.inOut",
})
.to(".landingMiddleSection", {
delay: 0.2,
});
});

return () => ctx.revert();
}, []);
Expand All @@ -95,7 +144,7 @@ export default function LandingMiddleSection() {
</nav>
<article>
<div className="landingGrid">
<h3>
<h3 className="fade-in-up">
<strong>๋งˆ์Œ</strong>์ด <br className="hide-768" />
๋‹ฟ๋Š” ์ˆœ๊ฐ„, <br />
<strong>์‘์›</strong>์ด <br className="hide-768" />
Expand All @@ -104,10 +153,10 @@ export default function LandingMiddleSection() {
<img src="/images/landing/landing_icon01.png" alt="" />
</span>
</h3>
<div className="landing-mockup">
<div className="landing-mockup fade-in-right">
<img src="/images/landing/landing_mock01.png" alt="" />
</div>
<p>
<p className="fade-in-up">
์ข‹์•„ํ•˜๋Š” ์•„ํ‹ฐ์ŠคํŠธ์—๊ฒŒ ์ง์ ‘ ํ›„์›ํ•˜๊ณ 
<br />
ํŒฌ์‹ฌ์„ ํ–‰๋™์œผ๋กœ ๋ณด์—ฌ์ฃผ์„ธ์š”.
Expand All @@ -120,18 +169,18 @@ export default function LandingMiddleSection() {
</article>
<article>
<div className="landingGrid">
<h3>
<h3 className="fade-in-up">
์ด๋ฒˆ ๋‹ฌ <br className="hide-768" />
<strong>๊ฐ€์žฅ ๋น›๋‚œ ๋ณ„</strong>์€ <br />
๋ˆ„๊ตฌ?
<span className="is-sparkling">
<img src="/images/landing/landing_icon02.png" alt="" />
</span>
</h3>
<div className="landing-mockup">
<div className="landing-mockup fade-in-right">
<img src="/images/landing/landing_mock02.png" alt="" />
</div>
<p>
<p className="fade-in-up">
ํŒฌ๋“ค์˜ ์‚ฌ๋ž‘์„ ๊ฐ€์žฅ ๋งŽ์ด ๋ฐ›์€
<br />
์ด๋‹ฌ์˜ ์•„ํ‹ฐ์ŠคํŠธ๋ฅผ ์†Œ๊ฐœํ•ฉ๋‹ˆ๋‹ค!
Expand All @@ -144,7 +193,7 @@ export default function LandingMiddleSection() {
</article>
<article>
<div className="landingGrid">
<h3>
<h3 className="fade-in-up">
๋‚ด ๋งˆ์Œ ์†
<span className="is-pulsing hide-425">
<img src="/images/landing/landing_icon03.png" alt="" />
Expand All @@ -158,10 +207,10 @@ export default function LandingMiddleSection() {
<img src="/images/landing/landing_icon03.png" alt="" />
</span>
</h3>
<div className="landing-mockup">
<div className="landing-mockup fade-in-right">
<img src="/images/landing/landing_mock03.png" alt="" />
</div>
<p>
<p className="fade-in-up">
๋‚ด๊ฐ€ ์ข‹์•„ํ•˜๋Š” ์•„ํ‹ฐ์ŠคํŠธ ์†Œ์‹๋งŒ ๊ณจ๋ผ๋ณด๊ณ  <br />
์ƒˆ๋กœ์šด ์ฝ˜ํ…์ธ ์™€ ์Šค์ผ€์ค„๋„ ํ•œ๋ˆˆ์—!
<br />
Expand All @@ -173,7 +222,6 @@ export default function LandingMiddleSection() {
</StyledLandingMiddleSection>
);
}

const StyledLandingMiddleSection = styled.section`
position: relative;

Expand Down Expand Up @@ -363,6 +411,7 @@ const StyledLandingMiddleSection = styled.section`
}
}
@media all and (max-width: 768px) {
height: auto !important;
.landingGrid {
gap: 20px;
flex-direction: column;
Expand All @@ -385,9 +434,13 @@ const StyledLandingMiddleSection = styled.section`
width: 40vw;
top: 70%;
img {
max-height: calc(65vh - 100px);
max-height: 400px;
}
}
article {
position: static;
height: 850px;
}
}
@media all and (max-width: 425px) {
span.show-425 {
Expand Down
Loading