<h1>Scroll down</h1>
<div class="trigger">
<div class="box"></div>
</div>
body {
height: 300vh;
}
.trigger {
position: absolute;
top: 75vh;
left: 0;
width: 100vw;
height: 80vh;
border-top: solid 2px var(--color-orangey);
padding: 20px;
}
.box {
width: 10vw;
height: 10vw;
}
const tl = gsap.timeline({
scrollTrigger: {
trigger: ".trigger",
start: "top top",
end: "+=1000",
scrub: 1,
pin: true,
markers: true
}
});
tl.to(".box", {yPercent: 350, duration: 1})
tl.to(".box", {rotation: 360, duration: 3})
tl.to(".box", {xPercent: 350, duration: 1})