I’ve implemented a marquee using CSS and GSAP in JavaScript. The text moves leftward and speeds up on scroll up, and vice versa, using GSAP’s ScrollTrigger. However, when the text reaches the end, there’s a noticeable gap before it restarts, disrupting the flow. How can I maintain an infinite marquee effect seamlessly with GSAP ScrollTrigger?
Here is my code so far:
`
</div>
<marquee class="marque">
<div class="marque_inner">
<div class="marque_part">
Hello
<div class="direction">
<svg viewBox="0 0 32 31" fill="none" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="16" cy="15.5" rx="16" ry="15.5" fill="#0F0D0E"/>
<path d="M24.2196 16.3536C24.4149 16.1583 24.4149 15.8417 24.2196 15.6464L21.0376 12.4645C20.8424 12.2692 20.5258 12.2692 20.3305 12.4645C20.1353 12.6597 20.1353 12.9763 20.3305 13.1716L23.159 16L20.3305 18.8284C20.1353 19.0237 20.1353 19.3403 20.3305 19.5355C20.5258 19.7308 20.8424 19.7308 21.0376 19.5355L24.2196 16.3536ZM9 16.5H23.8661V15.5H9V16.5Z" fill="#CD2C2C"/>
</svg>
</div>
</div>
<div class="marque_part">
Hello
<div class="direction">
<svg viewBox="0 0 32 31" fill="none" xmlns="http://www.w3.org/2000/svg">
<ellipse cx="16" cy="15.5" rx="16" ry="15.5" fill="#0F0D0E"/>
<path d="M24.2196 16.3536C24.4149 16.1583 24.4149 15.8417 24.2196 15.6464L21.0376 12.4645C20.8424 12.2692 20.5258 12.2692 20.3305 12.4645C20.1353 12.6597 20.1353 12.9763 20.3305 13.1716L23.159 16L20.3305 18.8284C20.1353 19.0237 20.1353 19.3403 20.3305 19.5355C20.5258 19.7308 20.8424 19.7308 21.0376 19.5355L24.2196 16.3536ZM9 16.5H23.8661V15.5H9V16.5Z" fill="#CD2C2C"/>
</svg>
</div>
</div>`
[https://jsfiddle.net/ek2wo6cz/1/]
I’ve implemented GSAP’s ScrollTrigger to control the animation speed based on scroll direction, which works well for the scrolling effect. However, the challenge lies in achieving a continuous, infinite marquee effect without pauses or gaps when the text reaches the end of its scroll area. I’ve considered adjusting the animation parameters and trigger settings but haven’t found a solution that maintains both the smooth scrolling control and the infinite marquee effect.
I’ve set up a CSS-marquee with GSAP animation triggered by scrolling. The issue arises when the text reaches the end of its scroll area, causing a pause before restarting. This gap disrupts the continuous marquee effect I’m aiming for. How can I ensure the text seamlessly restarts without affecting the GSAP ScrollTrigger functionality?
Shubh Vidyarthi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.