Skip to content

Commit

Permalink
Merge pull request #46 from softeerbootcamp4th/feature/7-intro
Browse files Browse the repository at this point in the history
[feat] 인트로 문구 애니메이션과 비디오 구현
  • Loading branch information
lybell-art authored Jul 29, 2024
2 parents 96c5710 + 6f0e2cc commit 3220b87
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 15 deletions.
18 changes: 11 additions & 7 deletions src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import { useEffect } from "react";
import IntroSection from "./introSection";

function App() {
useEffect(() => {
window.scrollTo(0, 0);
history.scrollRestoration = "manual";
}, []);

return (
<div className="text-5xl graphic-gradient">
<div className="flex flex-col">
<span>다람쥐 헌 쳇바퀴에 타고파</span>
<span>Hyundai Sans Text Office</span>
<span className="font-ds-digital">0123456789</span>
</div>
</div>
<>
<IntroSection />
</>
);
}

Expand Down
Binary file added src/introSection/car-spin.mp4
Binary file not shown.
45 changes: 39 additions & 6 deletions src/introSection/index.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
import useScrollTransition from "@/common/useScrollTransition.js";
import vector from "./vector.svg";
import style from "./index.module.css";
import SpinningCarVideo from "./car-spin.mp4";
import { useEffect, useRef } from "react";

function IntroSection() {
const videoRef = useRef(null);
const titleOpacity = useScrollTransition({
scrollStart: 0,
scrollEnd: 500,
Expand All @@ -12,14 +17,42 @@ function IntroSection() {
opacity: titleOpacity,
};

const videoTimeline = useScrollTransition({
scrollStart: 500,
scrollEnd: 1300,
valueStart: 0,
valueEnd: 2,
});

useEffect(() => {
videoRef.current.currentTime = videoTimeline;
}, [videoTimeline]);

return (
<div className="h-[2160px]">
<h1
className="text-8xl w-full flex items-center justify-center absolute top-[500px]"
style={titleStyle}
>
The new IONIQ 5
</h1>
<div className="z-50 fixed w-full flex justify-center top-[500px] -translate-y-1/2">
<h1
className={`${style.openTitle} ease-in text-8xl font-bold z-50`}
style={titleStyle}
>
The new IONIQ 5
</h1>

<div
className="absolute top-[66px] z-0 overflow-hidden"
style={titleStyle}
>
<img src={vector} />

<div
className={`${style.openVector} w-full h-full bg-white absolute top-0`}
/>
</div>
</div>

<div className="mt-[800px] flex justify-center items-center overflow-hidden z-0">
<video src={SpinningCarVideo} ref={videoRef} className="scale-125" />
</div>
</div>
);
}
Expand Down
27 changes: 27 additions & 0 deletions src/introSection/index.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
.openTitle {
animation: open-title 0.5s ease-in-out;
}

@keyframes open-title {
from {
transform: translateY(80px);
opacity: 0;
}
to {
transform: translateY(0px);
opacity: 1;
}
}

.openVector {
animation: open-vector 0.3s ease-in-out 0.3s forwards;
}

@keyframes open-vector {
from {
transform: translateX(0%);
}
to {
transform: translateX(100%);
}
}
9 changes: 9 additions & 0 deletions src/introSection/vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions tailwind.redefine.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@ export default {
"title-l": ["32px", "44px"],
"head-s": ["36px", "52px"],
"head-m": ["45px", "64px"],
"head-l": ["57px", "80px"]
}
"head-l": ["57px", "80px"],
},
};

0 comments on commit 3220b87

Please sign in to comment.