Skip to content

Commit

Permalink
[feat] 비디오 첨부, 스크롤 띠라 비디오 타임라인 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
darkdulgi committed Jul 29, 2024
1 parent 05d9ea0 commit 6f0e2cc
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
Binary file added src/introSection/car-spin.mp4
Binary file not shown.
24 changes: 21 additions & 3 deletions src/introSection/index.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +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 @@ -14,11 +17,22 @@ 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]">
<div className="pointer-events-none fixed w-full flex justify-center top-[500px] -translate-y-1/2">
<div className="z-50 fixed w-full flex justify-center top-[500px] -translate-y-1/2">
<h1
className={`${style.openTitle} ease-in text-8xl z-50`}
className={`${style.openTitle} ease-in text-8xl font-bold z-50`}
style={titleStyle}
>
The new IONIQ 5
Expand All @@ -32,9 +46,13 @@ function IntroSection() {

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

0 comments on commit 6f0e2cc

Please sign in to comment.