StealThis .dev

Infinite Marquee (GSAP)

A butter-smooth infinite marquee powered by GSAP ticker. Dynamically fills the viewport width with cloned items and reverses direction on hover.

Open in Lab
gsap
Targets: JS HTML

Code

Infinite Marquee (GSAP)

A silky-smooth infinite ticker using GSAP’s gsap.ticker and x transform — no CSS translateX, no duplicate DOM nodes required. Items are cloned dynamically to fill the viewport.

How it works

  1. Clone track items until the total width exceeds the viewport
  2. On each ticker frame, increment an xPos value by speed
  3. When xPos reaches -originalWidth, reset to 0 — seamless loop
gsap.ticker.add(() => {
  xPos -= speed;
  if (xPos <= -origW) xPos = 0;
  track.style.transform = `translateX(${xPos}px)`;
});

vs CSS marquee (lg-infinite-marquee)

CSS marqueeGSAP marquee
Speed controlCSS varJS variable
Reverse on hoverCSSGSAP gsap.to(speed)
Velocity easing✅ (ease in/out of speed)
DOM cloningManual duplicateAuto-fill viewport