Motion Kit

Text

Stacking Words

Splits text into lines and slides each line's words in from the right on scroll. Framework-agnostic Custom Element.

  • lit
  • gsap

Preview

↓ Scroll to reveal

Hell yeah!

Each line's words slide in from the right as you scroll. Scroll the preview below.
Attributes

Installation

pnpm dlx shadcn@latest add https://motion-kit-astro.vercel.app/r/stacking-words.json

Usage

---
import "@/components/motion-kit/stacking-words-element.ts";
---

<motion-stacking-words
  text="Every word arrives on its own."
  start="top 90%"
  end="top 30%"
></motion-stacking-words>

API Reference

Attribute Type Default
text The text content to display and animate. string ""
start ScrollTrigger start position (when animation begins). string "top 90%"
end ScrollTrigger end position (when animation completes). string "top 30%"
scrub Scrub duration in seconds for smooth scroll linking. number 1.234
stagger Delay between each word's animation in seconds. number 0.21
ease easing function for the animation. string "power3.out"
scroll-element CSS selector for scrollable container (defaults to window). string ""