# Rotating Text Animation

Motionboard shot name: Word Roll

One sentence, One AI tool to, ends in a pill whose phrase rolls up and out with a short blur while the next one rolls in from below. The pill resizes to each phrase, the last roll lands on do it all, and the sentence moves up for the Quire lockup.

- Position in a launch film: Opening
- Slug: rotating-text-animation
- Preview video: https://media.motionboard.app/word-roll.mp4
- Recipe page: https://motionboard.app/recipes/rotating-text-animation/
- License: MIT. Free to use in your own projects, including commercial launch films. https://github.com/krisyangdev/motionboard/blob/main/LICENSE

## How to use this recipe

You are a coding agent. The user wants this shot for their own product. Follow these steps.

1. **Know the product.** If the product is clear from the user's repo or conversation, ask nothing and start. Otherwise ask once for: product name, logo file, brand colors.
2. **Pick the output.** If the user's message says a video or their website, do that. Otherwise ask once which one they want.
   - **Video (HyperFrames).** Create a folder named `word-roll`. Download every file under "Source files" below with the curl commands, keeping relative paths. Adapt `index.html` (see "What to adapt"). Run `npx --yes hyperframes@0.8.209 check` on the untouched copy first and note its result. Preview with `npx --yes hyperframes@0.8.209 preview`, render an MP4 with `npx --yes hyperframes@0.8.209 render` (into `renders/`, named with a timestamp). The same commands are in `package.json` as `dev`, `check`, `render`; pass flags after `--`, as in `npm run render -- --quality draft`. Rendering needs network access for web fonts and GSAP.
   - **Website motion.** Port the GSAP timeline in `index.html` into the user's site, using their stack (React, Vue, Svelte, plain HTML). Build the same DOM structure, keep the timeline's durations, delays and easings exactly, and start it when the element scrolls into view (IntersectionObserver or ScrollTrigger). Respect `prefers-reduced-motion: reduce`: show the final frame as a static state and skip the movement.
3. **What to adapt.**
   - **Brand layer** (product name, logo, colors, fonts, copy): replace directly with the user's.
   - **UI layer** (the product screens, cards, windows, controls shown in the shot): rebuild the user's real UI as clean DOM, from their codebase (components, design tokens) or from a screenshot used as reference only. Never paste a screenshot into the shot.
   - **Motion** (timing, easing, camera moves, layering, stagger, order of events): keep exactly as in the source. This is what the recipe is.
   - The timeline targets UI elements by id and class, and camera moves land on fixed coordinates. Keep the ids the timeline uses, keep row counts and text lengths close to the source, and when the layout moves, update the target coordinates without changing the times.
4. **Fonts.** HyperFrames fetches Google Fonts such as Inter on its own. Some sources use macOS local fonts (PingFang, Songti via `local()`). Use the user's brand font when it can be bundled; for a system font such as SF Pro, use Inter. Check that text still fits its boxes.
5. **Verify.** Compare the render with the preview video above at the beat times in the Timing row. The beats, timing and camera should match; only brand and UI content differ.

## Spec

| Item | Value |
| --- | --- |
| Timing | Film 11s. Lead words rise 0.15–0.9s (0.5s, 0.08s stagger); pill fades in 0.4–0.95s with write docs inside; five rolls of 0.46s start at 1.5s, 2.72s, 3.94s, 5.16s and 6.38s with a 0.76s hold between them (the last roll ends at 6.84s); pill flash 6.9–7.4s; period drops in at 7.04s (0.4s); pill dissolves into plain text 7.4–7.8s; sentence moves up 7.9–8.55s; mark and wordmark rise 8.2–8.7s; tagline 8.28–8.73s; lockup still from 8.75s to the end (2.25s) |
| Easing | Lead words and lockup `cubic-bezier(0.16,1,0.3,1)` (expo.out); rolls, pill width, dissolve and move-up power3.inOut; old phrase fade power1.in, new phrase fade power1.out; blur out power1.out and blur in power2.out; flash power2.out then power2.inOut; ring expo.out; period back.out(2.4); sentence push linear (none) |
| Camera | Locked flat frame. The only movement is a slow constant push of the sentence, scale 1 to 1.025 over 0.75–7.9s, which stops before the sentence moves up 250px at 7.9–8.55s |
| Subject | One line centred on the frame in Inter 600 at 100px, letter spacing -0.03em, line height 120px: the lead words One AI tool to (26px between words, 30px after the last), then a pill 144px high with a 72px radius and 46px of padding on each side, so its width is the measured phrase width plus 92px. Six phrases sit stacked inside a window that clips top and bottom only: write docs, plan sprints, answer questions, draft emails, sum up meetings, do it all. Each roll moves 100px; the blur goes 0 to 6px over 0.24s on the old phrase and 6px to 0 over 0.3s on the new one, which starts 0.12s later and fades in over 0.3s. The pill resolves to the bare text width of do it all, and a period grows from 0px width to its own width. The lockup is a 116px indigo mark (rounded square, radius 30, three stacked pages), Quire at 116px Inter 700 and a 44px tagline |
| Sync | The pill width tween starts on the same frame as each roll and uses the same 0.46s power3.inOut curve; the new phrase starts fading in 0.12s after the old one starts moving; the flash starts 0.06s after the last roll ends and the period follows 0.14s later; the pill dissolves at 7.4s once the period has landed; the sentence starts moving up at 7.9s and the lockup rises at 8.2s, after it is already clear of the lockup's area |
| Style | Background `#f4f3ee` with a faint lilac glow `rgba(120,110,255,0.11)` at the top left, a faint peach glow `rgba(255,184,132,0.15)` at the bottom right and a vignette reaching 7% at the edges; ink `#121214`, pill `#e7e4ff` with text `#4338ca`, flash `#c4bdff`, one accent indigo `#4f46e5`; Inter 600 for the sentence, 700 for the wordmark; no grain |

## Why it works

Only one phrase changes and the rest of the sentence stays put, so the eye stays on one spot and reads each new phrase in the same place. The phrase moves up and out while the next one rolls in from below, and both carry a short blur (0 to 6px) and an opacity change, so the swap reads as one motion and the two phrases never sit crisp on top of each other. The pill width is measured per phrase and tweened on the same frames and the same curve as the roll, so the pill hugs each phrase and the sentence, centred as a whole, shifts only as much as the width changes. Each phrase holds 0.76s, long enough to read, and the 0.46s rolls keep a steady beat. The window clips only at the pill's top and bottom edges, so a long phrase is never cut at its sides while the pill is still narrower. The last roll lands on do it all, the pill flashes once, the period drops in and the pill dissolves into plain text, so the whole sentence reads as one finished claim before it moves up and gives way to the lockup. There is one accent color, indigo #4f46e5, on a warm off-white page.

## Prompt

> Build an 11-second, 1920x1080, 30 fps light product film called Word Roll for a fictional product, Quire (an AI workspace). Background #f4f3ee with a faint lilac radial glow rgba(120,110,255,0.11) at the top left, a faint peach glow rgba(255,184,132,0.15) at the bottom right and a vignette reaching 7% at the edges; ink #121214, one accent indigo #4f46e5, font Inter, no grain. One sentence sits on one line, centred: One AI tool to followed by a pill that holds a rotating phrase, in Inter 600 at 100px, letter spacing -0.03em, line height 120px. Build it as a flex row 144px high with justify-content centre, so it stays centred as the pill width changes: the four lead words One, AI, tool, to (26px gap, 30px margin after them), then the pill (144px high, 72px radius, background #e7e4ff, text #4338ca), then a period at width 0. Inside the pill put a window with clip-path inset(0 -700px 0 -700px), so only the top and bottom edges clip, and six absolutely positioned phrases centred in it: write docs, plan sprints, answer questions, draft emails, sum up meetings, do it all. Measure each phrase width once at load with a hidden span; the pill width for a phrase is its measured width plus 92px (46px padding on each side). Hide everything in CSS (opacity 0) and drive it with one paused GSAP timeline, with no CSS animations or transitions. Timeline: the lead words rise 26px and fade in from 0.15s (0.5s expo.out, 0.08s stagger); the pill rises 20px and fades in from 0.4s (0.55s expo.out), already showing write docs; a slow linear push of the sentence wrapper from scale 1 to 1.025 runs 0.75–7.9s. Five rolls start at 1.5, 2.72, 3.94, 5.16 and 6.38s (0.46s roll plus 0.76s hold). In each roll the old phrase moves up 100px over 0.46s (power3.inOut), fades out over 0.3s (power1.in) and blurs 0 to 6px over 0.24s; the new phrase starts 100px below with 6px blur, moves to 0 over 0.46s (power3.inOut), fades in over 0.3s starting 0.12s later (power1.out) and sharpens to 0 blur over 0.3s starting 0.14s later (power2.out); the pill width tweens to the new phrase width plus 92px over the same 0.46s with power3.inOut. After the last roll ends at 6.84s: at 6.9s the pill background goes from #e7e4ff to #c4bdff in 0.1s and back in 0.32s while a ring box-shadow 0 0 0 22px rgba(79,70,229,0), starting from alpha 0.4, expands over 0.5s (expo.out); at 7.04s the period grows to its measured width in 0.2s and drops in from 40px above with back.out(2.4) over 0.4s. From 7.4s to 7.8s the pill resolves into plain text: its width goes to the bare width of do it all, its background fades to alpha 0 and its colour goes to #121214 (power3.inOut), so the sentence reads One AI tool to do it all. At 7.9s the whole sentence moves up 250px over 0.65s (power3.inOut). The lockup sits below it: a 116px indigo #4f46e5 mark (rounded square, radius 30, three stacked white pages with two text lines on the front one), the word Quire at 116px Inter 700 with -0.04em letter spacing, and the tagline Your whole workday, in one place. at 44px Inter 500 in #6a6878. The mark and word rise 26px and fade in from 8.2s (0.5s expo.out); the tagline from 8.28s (0.45s expo.out). Everything is still from 8.75s to the end at 11s.

## Often confused with

- [Prompt Carousel](https://motionboard.app/r/prompt-carousel.md): Prompt Carousel types prompts into an input box and scrolls them; here one fixed sentence keeps its place and a single phrase inside a pill swaps, with the pill resizing to each phrase.
- [Typing Animation (Typewriter Effect)](https://motionboard.app/r/typing-animation.md): Rhythmic Typing writes, deletes and retypes text character by character; here whole phrases roll vertically with a short blur and the pill width follows each one.

## Source files

Runnable HyperFrames project, 3 files.

- https://motionboard.app/source/word-roll/hyperframes.json (318 B)
- https://motionboard.app/source/word-roll/index.html (8.6 KB)
- https://motionboard.app/source/word-roll/package.json (298 B)

Download all of them:

```sh
curl -fsSL --create-dirs -o "word-roll/hyperframes.json" "https://motionboard.app/source/word-roll/hyperframes.json"
curl -fsSL --create-dirs -o "word-roll/index.html" "https://motionboard.app/source/word-roll/index.html"
curl -fsSL --create-dirs -o "word-roll/package.json" "https://motionboard.app/source/word-roll/package.json"
```

## index.html

```html
<!doctype html>
<html lang="en" data-resolution="landscape">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=1920, height=1080" />
    <script src="https://cdn.jsdelivr.net/npm/gsap@3.14.2/dist/gsap.min.js"></script>
    <style>
      :root {
        --ink: #121214;
        --accent: #4f46e5;
        --pill: 231, 228, 255;
        --font-ui: "Inter", system-ui, sans-serif;
      }
      * { margin: 0; padding: 0; box-sizing: border-box; }
      html, body { width: 1920px; height: 1080px; overflow: hidden; background: #f4f3ee; }
      #root {
        position: relative; width: 1920px; height: 1080px; overflow: hidden;
        background:
          radial-gradient(1100px 760px at 14% 8%, rgba(120, 110, 255, 0.11), rgba(120, 110, 255, 0) 70%),
          radial-gradient(1000px 700px at 90% 96%, rgba(255, 184, 132, 0.15), rgba(255, 184, 132, 0) 70%),
          radial-gradient(ellipse at 50% 50%, rgba(244, 243, 238, 0) 55%, rgba(40, 36, 70, 0.07) 100%),
          #f4f3ee;
        font-family: var(--font-ui); color: var(--ink); -webkit-font-smoothing: antialiased;
      }
      #stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }
      #stage > * { position: absolute; }

      /* ---------- sentence ---------- */
      #sent { left: 0; top: 468px; width: 1920px; height: 144px; }
      #drift { position: absolute; left: 0; top: 0; width: 1920px; height: 144px; }
      #row {
        position: relative; width: 1920px; height: 144px; display: flex; justify-content: center; align-items: center;
        font-size: 100px; line-height: 120px; font-weight: 600; letter-spacing: -0.03em; white-space: nowrap; color: var(--ink);
      }
      #lead { display: flex; flex: none; gap: 0.26em; margin-right: 0.3em; }
      #lead .w { display: block; opacity: 0; }
      #pill {
        position: relative; flex: none; height: 144px; border-radius: 72px; opacity: 0;
        background: rgba(var(--pill), 1); color: #4338ca; box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
      }
      #win { position: absolute; left: 0; top: 0; width: 100%; height: 100%; clip-path: inset(0 -700px 0 -700px); }
      .ph { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; white-space: nowrap; opacity: 0; }
      #dot { flex: none; display: block; width: 0; min-width: 0; overflow: visible; opacity: 0; color: var(--ink); }
      .meas { position: absolute; left: -9999px; top: 0; visibility: hidden; white-space: nowrap; }

      /* ---------- lockup ---------- */
      #lm { left: 0; top: 580px; width: 1920px; height: 120px; display: flex; align-items: center; justify-content: center; gap: 30px; opacity: 0; }
      #lm .wm { font-size: 116px; line-height: 120px; font-weight: 700; letter-spacing: -0.04em; color: var(--ink); }
      #ltag { left: 0; top: 724px; width: 1920px; text-align: center; font-size: 44px; line-height: 56px; font-weight: 500; letter-spacing: -0.01em; color: #6a6878; opacity: 0; }
    </style>
  </head>
  <body>
    <div id="root" data-composition-id="main" data-start="0" data-duration="11" data-width="1920" data-height="1080">
      <div id="stage" class="clip" data-start="0" data-duration="11" data-track-index="0" data-layout-allow-overlap>
        <div id="sent">
          <div id="drift">
            <div id="row">
              <span id="lead"><span class="w">One</span><span class="w">AI</span><span class="w">tool</span><span class="w">to</span></span>
              <span id="pill"><span id="win"></span></span>
              <span id="dot">.</span>
            </div>
          </div>
        </div>
        <div id="lm"></div>
        <div id="ltag">Your whole workday, in one place.</div>
      </div>
    </div>

    <script>
      const EXPO = "expo.out";
      const EIO = "power3.inOut";
      const $ = (id) => document.getElementById(id);

      /* ---------- lockup mark ---------- */
      $("lm").innerHTML =
        '<svg width="116" height="116" viewBox="0 0 116 116"><rect width="116" height="116" rx="30" fill="#4f46e5"/>' +
        '<rect x="30" y="26" width="50" height="62" rx="10" fill="#ffffff" opacity="0.35" transform="rotate(-11 55 57)"/>' +
        '<rect x="34" y="28" width="50" height="62" rx="10" fill="#ffffff" opacity="0.62" transform="rotate(-4 59 59)"/>' +
        '<rect x="38" y="28" width="50" height="62" rx="10" fill="#ffffff"/>' +
        '<path d="M48 48h30M48 60h30M48 72h18" stroke="#4f46e5" stroke-width="5" stroke-linecap="round"/></svg>' +
        '<span class="wm">Quire</span>';

      /* ---------- phrases and measured widths ---------- */
      const PH = ["write docs", "plan sprints", "answer questions", "draft emails", "sum up meetings", "do it all"];
      const PAD = 46; // horizontal padding of the pill on each side
      const Y = 100; // roll distance
      const row = $("row");
      const win = $("win");
      const W = PH.map((p) => {
        const m = document.createElement("span");
        m.className = "meas";
        m.textContent = p;
        row.appendChild(m);
        const w = m.getBoundingClientRect().width;
        row.removeChild(m);
        return w;
      });
      const dm = document.createElement("span");
      dm.className = "meas";
      dm.textContent = ".";
      row.appendChild(dm);
      const DOTW = dm.getBoundingClientRect().width;
      row.removeChild(dm);

      PH.forEach((p, i) => {
        const e = document.createElement("span");
        e.className = "ph";
        e.id = "ph" + i;
        e.textContent = p;
        win.appendChild(e);
      });
      $("pill").style.width = W[0] + PAD * 2 + "px";
      $("ph0").style.opacity = "1";

      gsap.set("#lead .w", { y: 26 });
      gsap.set("#pill", { y: 20 });
      gsap.set("#ph0", { y: 0, filter: "blur(0px)" });
      for (let i = 1; i < PH.length; i++) gsap.set("#ph" + i, { y: Y, filter: "blur(6px)" });
      gsap.set("#dot", { y: -40 });
      gsap.set("#lm", { y: 26 });
      gsap.set("#ltag", { y: 20 });

      const tl = gsap.timeline({ paused: true });

      /* 1. lead words rise, pill fades in carrying the first phrase (0.15 - 0.9) */
      tl.to("#lead .w", { opacity: 1, y: 0, duration: 0.5, ease: EXPO, stagger: 0.08 }, 0.15);
      tl.to("#pill", { opacity: 1, y: 0, duration: 0.55, ease: EXPO }, 0.4);

      /* slow constant push on the sentence while it reads */
      tl.to("#drift", { scale: 1.025, duration: 7.15, ease: "none" }, 0.75);

      /* 2. five vertical rolls: 0.46 s each, 0.76 s hold between */
      const ROLL = 0.46;
      const FIRST = 1.5;
      const PITCH = ROLL + 0.76;
      let last = 0;
      for (let k = 1; k < PH.length; k++) {
        const t = FIRST + (k - 1) * PITCH;
        const o = "#ph" + (k - 1);
        const n = "#ph" + k;
        tl.to(o, { y: -Y, duration: ROLL, ease: EIO }, t);
        tl.to(o, { opacity: 0, duration: 0.3, ease: "power1.in" }, t);
        tl.to(o, { filter: "blur(6px)", duration: 0.24, ease: "power1.out" }, t);
        tl.to(n, { y: 0, duration: ROLL, ease: EIO }, t);
        tl.to(n, { opacity: 1, duration: 0.3, ease: "power1.out" }, t + 0.12);
        tl.to(n, { filter: "blur(0px)", duration: 0.3, ease: "power2.out" }, t + 0.14);
        tl.to("#pill", { width: W[k] + PAD * 2, duration: ROLL, ease: EIO }, t);
        last = t + ROLL; // 6.84
      }

      /* 3. flash on the last phrase, period lands (6.9 - 7.4) */
      tl.to("#pill", { backgroundColor: "rgba(196,189,255,1)", duration: 0.1, ease: "power2.out" }, last + 0.06);
      tl.to("#pill", { backgroundColor: "rgba(231,228,255,1)", duration: 0.32, ease: "power2.inOut" }, last + 0.16);
      tl.to("#pill", { boxShadow: "0 0 0 22px rgba(79,70,229,0)", duration: 0.5, ease: EXPO }, last + 0.06);
      tl.set("#pill", { boxShadow: "0 0 0 0 rgba(79,70,229,0.4)" }, last + 0.055);
      tl.to("#dot", { width: DOTW, duration: 0.2, ease: "power2.out" }, last + 0.2);
      tl.to("#dot", { opacity: 1, duration: 0.15, ease: "power1.out" }, last + 0.2);
      tl.to("#dot", { y: 0, duration: 0.4, ease: "back.out(2.4)" }, last + 0.2);

      /* 4. pill resolves into plain text (7.4 - 7.8) */
      const RES = last + 0.56; // 7.40
      tl.to("#pill", { width: W[PH.length - 1], duration: 0.4, ease: EIO }, RES);
      tl.to("#pill", { backgroundColor: "rgba(231,228,255,0)", color: "#121214", duration: 0.4, ease: EIO }, RES);

      /* 5. sentence moves up, lockup settles (7.9 - 8.7) */
      tl.to("#sent", { y: -250, duration: 0.65, ease: EIO }, 7.9);
      tl.to("#lm", { opacity: 1, y: 0, duration: 0.5, ease: EXPO }, 8.2);
      tl.to("#ltag", { opacity: 1, y: 0, duration: 0.45, ease: EXPO }, 8.28);

      tl.set({}, {}, 11);
      window.__timelines = window.__timelines || {};
      window.__timelines["main"] = tl;
    </script>
  </body>
</html>
```
