Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lucastavarex committed Nov 26, 2024
1 parent bdec13a commit e93aa0f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/pages/supercentro/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ gsap.registerPlugin(ScrollTrigger);

export default function SuperCentro() {
const videoRef = useRef(null);
const totalFrames = 24 * videoRef.current?.duration || 0; // 24 FPS * video duration
const videoScrollRef = useRef(null);

useEffect(() => {
Expand All @@ -17,10 +16,10 @@ export default function SuperCentro() {

// Wait until the video metadata is loaded to get the duration
video.addEventListener("loadedmetadata", () => {
const totalFrames = 48 * video.duration;
const totalFrames = 24 * video.duration;

gsap.to(video, {
currentTime: totalFrames / 48,
currentTime: totalFrames / 24,
scrollTrigger: {
trigger: videoScrollRef.current,
start: "top top",
Expand All @@ -29,7 +28,7 @@ export default function SuperCentro() {
onUpdate: (self) => {
// Calculate the frame based on scroll progress
const frame = Math.round(self.progress * totalFrames);
video.currentTime = frame / 48; // Set the current video time
video.currentTime = frame / 24; // Set the current video time
},
},
});
Expand Down

0 comments on commit e93aa0f

Please sign in to comment.