I have this scroll effect where its playing through the video on scroll. But is there a way to make it so when I scroll it scrolls down to specific time parts, and then stop on each? to create a “slideshow feel”. right now I’m using scrollmagic to achieve what I have.
The code for how it works now:
<div className="intro bg-black">
<h1 className="uppercase text-center text-white text-5xl">We Present Our New App<span className="text-rose-300">.</span></h1>
<div className="bounce">
<i className="fa-solid fa-circle-arrow-down scrollDown text-rose-300 text-5xl"></i>
</div>
<video className="appVideo" muted={true} preload="auto" src={video}></video>
</div>
const intro = document.querySelector('.intro');
const introVideo = document.querySelector('.appVideo');
// Scrollmagic controller
const controller = new ScrollMagic.Controller();
let scene = new ScrollMagic.Scene({
duration: 53000, // length of video in ms
triggerElement: intro,
triggerHook: 0
})
.setPin(intro)
.addTo(controller);
// Video Animation
let accelamount = 0.1;
let scrollpos = 0;
let delay = 0;
scene.on('update', e =>{
scrollpos = e.scrollPos / 1000;
});
// Makes the video not stop imideatly when you stop scrolling for smoother experience.
setInterval(() => {
delay += (scrollpos - delay) * accelamount;
introVideo.currentTime = delay;
}, 33.33);