# Sound Wave Animation

Motionboard shot name: Voice Note Pill

A round mic button is clicked and widens into a pill with a live waveform, a record dot and a timer, while a transcript appears word by word above it. The pill then collapses into a note card, three audio player cards stack in with a playhead sweeping the first, and the Echo lockup follows.

- Position in a launch film: Features
- Slug: sound-wave-animation
- Preview video: https://media.motionboard.app/voice-wave.mp4
- Recipe page: https://motionboard.app/recipes/sound-wave-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 `voice-wave`. 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. Cursor click 0.8s; pill opens 0.95–1.7s (0.75s); recording and timer start at 1.6s (0:03 at 4.6s); 11 words revealed 1.89–4.59s; stop click 5.05s; contents and transcript fade 5.15–5.65s; the pill morphs into the note card 5.4–6.2s (0.8s); player cards enter at 6.0s, 6.18s and 6.36s (0.7s each); play pressed 6.65s and the playhead sweeps 6.75–7.95s (1.2s); scene fades 7.95–8.25s; lockup 8.3–8.8s and holds 2.2s |
| Easing | Pill opening `expo.inOut`; card rise and lockup `expo.out`; cursor moves power3.inOut and power2.inOut; pill-to-note morph power3.inOut; button presses power2.out then back.out; word reveal power2.out (0.3s) with a 0.5s colour change; the playhead sweep is linear because playback speed is constant; the speech envelope and bar heights are computed on every frame from time |
| Camera | Locked frame, no camera moves. The pill and transcript sit centred around y=590px, and the note and player cards form one 1200px column from x=360px. Faint grey and warm blobs drift slowly (sine.inOut over the whole 11s) behind the content |
| Subject | Mic button 160px circle with a 76px mic icon and a halo ring pulsing every 1.1s until the click; pill 1100x180px, radius 90px, centred at (960, 590): record dot 22px, timer 48px bold, 62 waveform bars 6px wide with a 5px gap (677px), 10–130px tall, with a left edge fade, and a 104px stop button; transcript 68px, weight 650, two lines on an 84px line height, 60px above the pill; note card 1200x250px, radius 38px, top 154px, with a 44px mark, a 58px title, 32px body text and a 28px chip; three player cards 1200x150px at tops 432px, 604px and 776px, each with a 100px art tile, a 36px title, 28px meta, an 80px play button and 75 bars 4px wide with a 2px gap (450px, 10–80px tall); playhead 3px wide; cursor 44px |
| Sync | Each word appears 0.14s after its swell starts in the waveform; the timer ticks at 2.6s, 3.6s and 4.6s and the glow behind the pill follows the same level; the last word ends at 4.85s and the bars are flat before the cursor reaches the stop button at 5.0s; the play icon turns into pause at 6.7s and the playhead starts at 6.75s |
| Style | Background `#09090b` with faint grey and warm blobs, one accent coral `#ff5b45`; Inter throughout, text `#f4f4f6` and secondary text `#a1a1aa`; cards in dark grey gradients with a 1.5px hairline border and a large soft shadow; played bars coral, unplayed bars white at 30%; static grain at 5% and a vignette reaching 55% black at the edges. Lockup: a 156px coral mark with five white bars, Echo at 176px and Say it once. Keep it. at 34px |

## Why it works

The waveform is the shot, so it is the biggest moving element: 62 white bars up to 130px tall inside a 180px pill. Their heights come from a speech envelope computed from timeline time: each word is a short swell, there is near silence between words, and the bars scroll in from the right edge, so the pill reads as a live microphone. The transcript above it uses the same word start times and each word appears 0.14s after its swell, so the eye links what it hears to what it reads. The timer, the pulsing record dot and a coral glow behind the pill follow the same envelope. A cursor click starts the move and a second click on the stop button ends it, so every change has a cause on screen. The pill then collapses into a note card and three audio players fill the same column; their static waveforms and a coral playhead show the same shape as a saved file. One accent colour, coral #ff5b45, marks everything live: the record dot, the stop button and the played part of each waveform.

## Prompt

> Build an 11-second, 1920x1080, 30 fps dark product film called Voice Note Pill for a fictional product, Echo (a voice notes app). Background #09090b with faint grey and warm radial blobs drifting slowly (sine.inOut over 11s), one accent coral #ff5b45, font Inter, text #f4f4f6, secondary text #a1a1aa. Put all time-driven state in one render(t) function called from a linear proxy tween's onUpdate and from the hf-seek event; use no CSS animations and no random numbers (hash the bar index with a sine instead). Beat 1: a 160px round mic button (dark gradient, 1.5px hairline border, 76px mic icon) sits at (960, 590) with a halo ring pulsing every 1.1s. A 44px cursor arrives from the lower right (0.12–0.77s, power3.inOut) and clicks at 0.8s (button and cursor scale to 0.93 and 0.84, back.out). From 0.95s the button widens in 0.75s (expo.inOut) into a 1100x180px pill with radius 90px; the icon fades out and from 1.3s the contents fade in: a 22px red record dot pulsing once per second, a 48px bold timer, a waveform of 62 white bars (6px wide, 5px gap, 10–130px tall, rounded, faded at the left edge) and a 104px coral stop button with a white square, which pops in with back.out at 1.5s. The pill border turns coral at 40% and a 1500x520px coral glow behind it follows the speech level. The timer starts at 1.6s and reads 0:03 at 4.6s. Speech envelope: 11 words with start times and lengths (Remind 1.75/0.30, me 2.05/0.18, to 2.25/0.20, send 2.5/0.22, the 2.75/0.18, Q3 2.95/0.28, deck 3.25/0.30, to 3.6/0.20, Priya 3.85/0.38, on 4.25/0.18, Friday 4.45/0.40); level = max over words of sin(pi*u)^0.6 times a syllable factor 0.6+0.4*|cos(pi*u*k)| (k=2 for words over 0.25s) times 0.72–1, plus a 0.05 floor from 1.6 to 5.05s. Bar i shows the level sampled at floor(t*15)-(61-i) steps of 1/15s, times 0.58–1.0 from the hash, so the bars scroll left every 2 frames. Above the pill a 68px, weight 650 transcript on two lines (Remind me to send the Q3 deck / to Priya on Friday) is laid out fully with every word at opacity 0; each word fades in over 0.3s (power2.out, 14px rise) 0.14s after its voice start and turns from #8b8b95 to #f4f4f6 over 0.5s. The cursor returns at 4.45–5.0s to the stop button and clicks at 5.05s. Beat 2: contents and transcript fade (5.15–5.65s); the pill morphs with power3.inOut over 0.8s from 5.4s into a 1200x250px card at top 154px (radius 38px) holding a mark, New voice note, a Fri, 9:00 AM chip, the title Send Q3 deck to Priya (58px) and the sentence (32px). Three player cards, 1200x150px at tops 432, 604 and 776, enter at 6.0, 6.18 and 6.36s (expo.out, 0.7s, 64px rise): a 100px art tile, a 36px title (Monday standup, Call with Dana, Onboarding ideas), 28px meta, an 80px play button and 75 static bars (4px wide, 2px gap, 10–80px tall). At 6.65s the first play button turns coral and shows pause; from 6.75 to 7.95s a 3px white playhead moves linearly to 72% and the bars it passes turn coral; the second card rests at 34% played. At 7.95s the scene fades over 0.3s; the lockup at 8.3–8.8s is a 156px coral mark with five white bars, Echo at 176px and Say it once. Keep it. at 34px, still for 2.2s. Add static grain at 5% and a vignette.

## Often confused with

- [Scrolling Text Animation](https://motionboard.app/r/scrolling-text-animation.md): Scrolling Text Animation condenses a long dictated input into one short summary; here the dictation is a live waveform with a word-by-word transcript, and the result is a note card with saved audio players.
- [Lyrics Animation](https://motionboard.app/r/lyrics-animation.md): Lyrics Animation scrolls dimmed lines and brightens each word as it is sung; here the words appear as they are heard, driven by a live waveform, and the shot ends on audio players with a playhead.

## Source files

Runnable HyperFrames project, 3 files.

- https://motionboard.app/source/voice-wave/hyperframes.json (318 B)
- https://motionboard.app/source/voice-wave/index.html (23.3 KB)
- https://motionboard.app/source/voice-wave/package.json (299 B)

Download all of them:

```sh
curl -fsSL --create-dirs -o "voice-wave/hyperframes.json" "https://motionboard.app/source/voice-wave/hyperframes.json"
curl -fsSL --create-dirs -o "voice-wave/index.html" "https://motionboard.app/source/voice-wave/index.html"
curl -fsSL --create-dirs -o "voice-wave/package.json" "https://motionboard.app/source/voice-wave/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 {
        --bg: #09090b;
        --ink: #f4f4f6;
        --sub: #a1a1aa;
        --mut: #71717a;
        --card: #151518;
        --line: rgba(255, 255, 255, 0.09);
        --accent: #ff5b45;
        --font-ui: "Inter", -apple-system, "SF Pro Text", "Helvetica Neue", sans-serif;
      }
      * { margin: 0; padding: 0; box-sizing: border-box; }
      html, body { width: 1920px; height: 1080px; overflow: hidden; background: var(--bg); }
      #root { position: relative; width: 1920px; height: 1080px; overflow: hidden; background: var(--bg); font-family: var(--font-ui); color: var(--ink); -webkit-font-smoothing: antialiased; }
      .layer { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }
      .a { position: absolute; }
      svg { display: block; }

      /* ---------- backdrop ---------- */
      #bg { overflow: hidden; background: #09090b; }
      .blob { position: absolute; border-radius: 50%; }
      #b1 { left: -360px; top: -460px; width: 1500px; height: 1100px; background: radial-gradient(closest-side, rgba(150, 150, 168, 0.2) 0%, rgba(150, 150, 168, 0) 100%); }
      #b2 { left: 1040px; top: 520px; width: 1300px; height: 960px; background: radial-gradient(closest-side, rgba(255, 110, 80, 0.09) 0%, rgba(255, 110, 80, 0) 100%); }
      #b3 { left: -300px; top: 560px; width: 1100px; height: 800px; background: radial-gradient(closest-side, rgba(110, 120, 170, 0.1) 0%, rgba(110, 120, 170, 0) 100%); }
      #glow { left: 210px; top: 330px; width: 1500px; height: 520px; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 91, 69, 0.55) 0%, rgba(255, 91, 69, 0) 100%); opacity: 0; }

      /* ---------- scene ---------- */
      #scene { z-index: 4; }
      #tx { left: 310px; top: 268px; width: 1300px; height: 168px; text-align: center; font-size: 68px; line-height: 84px; font-weight: 650; letter-spacing: -0.03em; white-space: nowrap; }
      #tx .ln { display: block; height: 84px; }
      #tx .w { display: inline-block; margin-right: 0.26em; color: #8b8b95; opacity: 0; }
      #tx .w.z { margin-right: 0; }

      #ring { left: 880px; top: 510px; width: 160px; height: 160px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.22); opacity: 0; }
      #pill { left: 880px; top: 510px; width: 160px; height: 160px; border-radius: 80px; background: linear-gradient(180deg, #1d1d22 0%, #121215 100%); border: 1.5px solid rgba(255, 255, 255, 0.12); box-shadow: 0 34px 90px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.07); overflow: hidden; z-index: 5; }
      #micw { left: 0; top: 0; width: 100%; height: 160px; display: flex; align-items: center; justify-content: center; }
      #pc { left: 0; top: 0; width: 1100px; height: 180px; opacity: 0; }
      #rdot { left: 56px; top: 79px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 18px rgba(255, 91, 69, 0.7); }
      #timer { left: 94px; top: 60px; width: 140px; font-size: 48px; line-height: 60px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--ink); }
      #lw { left: 250px; top: 0; width: 677px; height: 180px; display: flex; align-items: center;
        -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 100%); mask-image: linear-gradient(90deg, transparent 0, #000 14%, #000 100%); }
      #lw i { display: block; flex: none; width: 6px; height: 10px; margin-right: 5px; border-radius: 3px; background: #f4f4f6; }
      #stop { left: 960px; top: 38px; width: 104px; height: 104px; border-radius: 50%; background: var(--accent); display: flex; align-items: center; justify-content: center; box-shadow: 0 12px 30px rgba(255, 91, 69, 0.35); }
      #stop i { display: block; width: 34px; height: 34px; border-radius: 9px; background: #fff; }

      #notec { left: 0; top: 0; width: 1200px; height: 250px; opacity: 0; }
      #nmk { left: 48px; top: 32px; width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, #ff7a59, #ff4a3d); display: flex; align-items: center; justify-content: center; gap: 3px; }
      #nmk i { display: block; width: 4px; border-radius: 2px; background: #fff; }
      #nhd { left: 106px; top: 36px; font-size: 28px; line-height: 36px; font-weight: 600; color: var(--sub); white-space: nowrap; }
      #nchip { right: 48px; top: 30px; height: 48px; padding: 0 20px; border-radius: 24px; background: rgba(255, 91, 69, 0.15); color: #ff7a66; font-size: 28px; line-height: 48px; font-weight: 650; white-space: nowrap; }
      #nti { left: 48px; top: 96px; font-size: 58px; line-height: 66px; font-weight: 700; letter-spacing: -0.03em; white-space: nowrap; }
      #nbd { left: 48px; top: 174px; font-size: 32px; line-height: 42px; font-weight: 450; color: var(--sub); white-space: nowrap; }

      .pc { left: 360px; width: 1200px; height: 150px; border-radius: 38px; background: linear-gradient(180deg, #19191d 0%, #131316 100%); border: 1.5px solid rgba(255, 255, 255, 0.09); box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.05); opacity: 0; z-index: 3; }
      .pc .art { left: 28px; top: 25px; width: 100px; height: 100px; border-radius: 28px; background: linear-gradient(145deg, #3d3d46, #25252b); display: flex; align-items: center; justify-content: center; }
      .pc .art.hot { background: linear-gradient(145deg, #ff7a59, #e8402f); }
      .pc .tt { left: 156px; top: 28px; width: 400px; font-size: 36px; line-height: 44px; font-weight: 650; letter-spacing: -0.02em; white-space: nowrap; }
      .pc .mt { left: 156px; top: 78px; width: 400px; font-size: 28px; line-height: 36px; font-weight: 450; color: var(--sub); white-space: nowrap; font-variant-numeric: tabular-nums; }
      .pc .pb { left: 590px; top: 35px; width: 80px; height: 80px; border-radius: 50%; background: #2c2c32; }
      .pc .pb .ic { position: absolute; left: 0; top: 0; width: 80px; height: 80px; display: flex; align-items: center; justify-content: center; }
      .pc .pb .pa { opacity: 0; }
      .pc .wv { left: 710px; top: 0; width: 450px; height: 150px; display: flex; align-items: center; }
      .pc .wv i { display: block; flex: none; width: 4px; margin-right: 2px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); }
      .pc .ph { left: 0; top: 22px; width: 3px; height: 106px; margin-left: 710px; border-radius: 2px; background: #fff; box-shadow: 0 0 10px rgba(255, 255, 255, 0.35); }

      #cur { left: -7px; top: -5px; z-index: 20; opacity: 0; }
      #cur svg { transform-origin: 7px 5px; }

      /* ---------- lockup ---------- */
      #end { z-index: 8; }
      #lock { left: 0; top: 0; width: 1920px; height: 1080px; display: flex; align-items: center; justify-content: center; gap: 46px; }
      #lmk { position: relative; width: 156px; height: 156px; border-radius: 40px; background: linear-gradient(135deg, #ff7a59, #ff4a3d); box-shadow: 0 26px 70px rgba(255, 91, 69, 0.4); flex: none; opacity: 0; }
      #lmk i { position: absolute; width: 12px; border-radius: 6px; background: #fff; }
      #lcol { position: relative; }
      #lwm { font-size: 176px; line-height: 210px; font-weight: 700; letter-spacing: -0.055em; color: var(--ink); white-space: nowrap; opacity: 0; }
      #lsub { margin-top: -4px; margin-left: 6px; font-size: 34px; line-height: 44px; font-weight: 500; letter-spacing: -0.015em; color: var(--sub); white-space: nowrap; opacity: 0; }

      /* ---------- finish ---------- */
      #fx { z-index: 9; pointer-events: none; background: radial-gradient(ellipse 80% 85% at 50% 48%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, 0.55) 100%); }
      #grain { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; opacity: 0.05; mix-blend-mode: screen; }
    </style>
  </head>
  <body>
    <div id="root" data-composition-id="main" data-start="0" data-duration="11" data-width="1920" data-height="1080">
      <div id="bg" class="layer clip" data-start="0" data-duration="11" data-track-index="0" data-layout-allow-overlap data-layout-allow-overflow>
        <div id="b1" class="blob"></div><div id="b2" class="blob"></div><div id="b3" class="blob"></div>
        <div id="glow" class="a"></div>
      </div>

      <div id="scene" class="layer clip" data-start="0" data-duration="8.3" data-track-index="1" data-layout-allow-overlap data-layout-allow-overflow>
        <div id="tx" class="a" data-layout-allow-overlap data-layout-allow-overflow>
          <span class="ln"><span class="w">Remind</span><span class="w">me</span><span class="w">to</span><span class="w">send</span><span class="w">the</span><span class="w">Q3</span><span class="w z">deck</span></span>
          <span class="ln"><span class="w">to</span><span class="w">Priya</span><span class="w">on</span><span class="w z">Friday</span></span>
        </div>

        <div id="ring" class="a"></div>
        <div id="pill" class="a" data-layout-allow-overlap data-layout-allow-overflow>
          <div id="micw" class="a">
            <svg width="76" height="76" viewBox="0 0 24 24" fill="none" stroke="#f4f4f6" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="3" width="6" height="11" rx="3"></rect><path d="M5.5 11.5a6.5 6.5 0 0 0 13 0"></path><path d="M12 18v3"></path><path d="M9 21h6"></path></svg>
          </div>
          <div id="pc" class="a" data-layout-allow-overlap data-layout-allow-overflow>
            <div id="rdot" class="a"></div>
            <div id="timer" class="a">0:00</div>
            <div id="lw" class="a"></div>
            <div id="stop" class="a"><i></i></div>
          </div>
          <div id="notec" class="a" data-layout-allow-overlap>
            <div id="nmk" class="a"><i style="height:12px"></i><i style="height:22px"></i><i style="height:16px"></i></div>
            <div id="nhd" class="a">New voice note</div>
            <div id="nchip" class="a">Fri, 9:00 AM</div>
            <div id="nti" class="a">Send Q3 deck to Priya</div>
            <div id="nbd" class="a">Remind me to send the Q3 deck to Priya on Friday</div>
          </div>
        </div>

        <div id="pc1" class="a pc" data-layout-allow-overlap data-layout-allow-overflow style="top:432px">
          <div class="a art hot"><svg width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="#fff" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6h11M9 12h11M9 18h11"></path><circle cx="4.5" cy="6" r="0.9"></circle><circle cx="4.5" cy="12" r="0.9"></circle><circle cx="4.5" cy="18" r="0.9"></circle></svg></div>
          <div class="a tt">Monday standup</div><div class="a mt">0:42 · Mon 9:14 AM</div>
          <div class="a pb"><div class="ic pl"><svg width="32" height="32" viewBox="0 0 24 24" fill="#fff"><path d="M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z"></path></svg></div><div class="ic pa"><svg width="32" height="32" viewBox="0 0 24 24" fill="#fff"><rect x="6" y="5" width="4.2" height="14" rx="1.4"></rect><rect x="13.8" y="5" width="4.2" height="14" rx="1.4"></rect></svg></div></div>
          <div id="wv1" class="a wv"></div><div id="ph1" class="a ph" style="opacity:0"></div>
        </div>
        <div id="pc2" class="a pc" data-layout-allow-overlap data-layout-allow-overflow style="top:604px">
          <div class="a art"><svg width="50" height="50" viewBox="0 0 24 24" fill="#f4f4f6"><path d="M6.6 10.8a15 15 0 0 0 6.6 6.6l2.2-2.2a1 1 0 0 1 1-.25 11.4 11.4 0 0 0 3.6.57 1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.25 1z"></path></svg></div>
          <div class="a tt">Call with Dana</div><div class="a mt">3:18 · Sun 4:02 PM</div>
          <div class="a pb"><div class="ic"><svg width="32" height="32" viewBox="0 0 24 24" fill="#fff"><path d="M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z"></path></svg></div></div>
          <div id="wv2" class="a wv"></div><div id="ph2" class="a ph"></div>
        </div>
        <div id="pc3" class="a pc" data-layout-allow-overlap data-layout-allow-overflow style="top:776px">
          <div class="a art"><svg width="52" height="52" viewBox="0 0 24 24" fill="none" stroke="#f4f4f6" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"><path d="M9 18h6M10 21h4M12 3a6 6 0 0 0-3.5 10.9c.6.5 1 1.2 1 2V16h5v-.1c0-.8.4-1.5 1-2A6 6 0 0 0 12 3z"></path></svg></div>
          <div class="a tt">Onboarding ideas</div><div class="a mt">1:07 · Fri 6:40 PM</div>
          <div class="a pb"><div class="ic"><svg width="32" height="32" viewBox="0 0 24 24" fill="#fff"><path d="M8 5.5v13a1 1 0 0 0 1.5.86l10.5-6.5a1 1 0 0 0 0-1.72L9.5 4.64A1 1 0 0 0 8 5.5z"></path></svg></div></div>
          <div id="wv3" class="a wv"></div>
        </div>

        <div id="cur" class="a"><svg width="44" height="44" viewBox="0 0 24 24"><path d="M4 2.5v17l4.6-4.1 3.2 7 3-1.4-3.2-6.9H18z" fill="#fff" stroke="#0b0b0d" stroke-width="1.4" stroke-linejoin="round"></path></svg></div>
      </div>

      <div id="end" class="layer clip" data-start="8.3" data-duration="2.7" data-track-index="2" data-layout-allow-overlap>
        <div id="lock" class="a" data-layout-allow-overlap>
          <div id="lmk"><i style="left:28px;top:60px;height:36px"></i><i style="left:50px;top:43px;height:70px"></i><i style="left:72px;top:30px;height:96px"></i><i style="left:94px;top:50px;height:56px"></i><i style="left:116px;top:63px;height:30px"></i></div>
          <div id="lcol"><div id="lwm">Echo</div><div id="lsub">Say it once. Keep it.</div></div>
        </div>
      </div>

      <div id="fx" class="layer clip" data-start="0" data-duration="11" data-track-index="3" data-layout-ignore>
        <svg id="grain" width="1920" height="1080" viewBox="0 0 1920 1080" aria-hidden="true"><filter id="gn" x="0" y="0" width="100%" height="100%"><feTurbulence type="fractalNoise" baseFrequency="0.85" numOctaves="2" seed="7" stitchTiles="stitch" /><feColorMatrix type="saturate" values="0" /></filter><rect width="1920" height="1080" filter="url(#gn)" /></svg>
      </div>
    </div>

    <script>
      const $ = (s) => document.querySelector(s);
      const clamp = (v) => Math.max(0, Math.min(1, v));
      const hash = (s) => { const x = Math.sin(s * 127.1 + 311.7) * 43758.5453; return x - Math.floor(x); };

      /* ---------- speech envelope (all values computed from time) ---------- */
      // [word, start, duration]; the transcript reveals each word 0.14 s after the voice starts
      const WORDS = [
        ["Remind", 1.75, 0.30], ["me", 2.05, 0.18], ["to", 2.25, 0.20], ["send", 2.5, 0.22], ["the", 2.75, 0.18], ["Q3", 2.95, 0.28],
        ["deck", 3.25, 0.30], ["to", 3.6, 0.20], ["Priya", 3.85, 0.38], ["on", 4.25, 0.18], ["Friday", 4.45, 0.40]
      ];
      const REC0 = 1.6, REC1 = 5.0; // recording runs, then the stop click at 5.05
      function lvl(t) {
        if (t < REC0 || t > REC1 + 0.05) return 0;
        let m = 0.05;
        for (let i = 0; i < WORDS.length; i++) {
          const w = WORDS[i];
          const u = (t - w[1]) / w[2];
          if (u < 0 || u > 1) continue;
          const e = Math.pow(Math.sin(Math.PI * u), 0.6);
          const syl = 0.6 + 0.4 * Math.abs(Math.cos(Math.PI * u * (w[2] > 0.25 ? 2 : 1)));
          const amp = 0.72 + 0.28 * hash(i * 7.3 + 1.1);
          m = Math.max(m, e * syl * amp);
        }
        return m;
      }

      /* ---------- build bars ---------- */
      const NL = 62, DT = 1 / 15;
      const lw = $("#lw"); const liveBars = [];
      for (let i = 0; i < NL; i++) { const b = document.createElement("i"); lw.appendChild(b); liveBars.push(b); }
      const liveH = new Array(NL).fill(-1);

      const NP = 75, PW = 450;
      const cards = [
        { wv: "#wv1", seed: 2.3, bars: [], on: [], hs: [] },
        { wv: "#wv2", seed: 5.9, bars: [], on: [], hs: [] },
        { wv: "#wv3", seed: 9.4, bars: [], on: [], hs: [] }
      ];
      cards.forEach((c) => {
        const host = $(c.wv);
        for (let i = 0; i < NP; i++) {
          const v = (0.3 + 0.7 * Math.abs(Math.sin(i * 0.21 + c.seed * 1.7) * Math.cos(i * 0.073 + c.seed))) * (0.45 + 0.55 * hash(i * 3 + c.seed * 91));
          const h = Math.round(10 + Math.pow(v, 0.7) * 70);
          const b = document.createElement("i"); b.style.height = h + "px"; host.appendChild(b);
          c.bars.push(b); c.on.push(false);
        }
      });
      const ON = "#ff5b45", OFF = "rgba(255,255,255,0.3)";
      function setProgress(c, p) {
        for (let j = 0; j < NP; j++) {
          const on = (j + 0.5) / NP < p;
          if (on !== c.on[j]) { c.on[j] = on; c.bars[j].style.background = on ? ON : OFF; }
        }
      }

      /* ---------- render everything that is computed from time ---------- */
      const P1_T0 = 6.75, P1_T1 = 7.95, P1_END = 0.72, P2 = 0.34;
      function render(t) {
        // idle halo around the mic button
        const ph = (t / 1.1) % 1;
        const ring = $("#ring");
        ring.style.opacity = t < 0.8 ? (0.4 * (1 - ph)).toFixed(3) : "0";
        ring.style.transform = "scale(" + (1 + 0.45 * ph).toFixed(3) + ")";

        // live waveform: history of the speech level, one sample every 2 frames
        const cur = Math.floor(t / DT);
        for (let i = 0; i < NL; i++) {
          const s = cur - (NL - 1 - i);
          const v = lvl(s * DT) * (0.58 + 0.42 * hash(s));
          const h = Math.round((10 + Math.min(1, v * 1.3) * 120) * 2) / 2;
          if (h !== liveH[i]) { liveH[i] = h; liveBars[i].style.height = h + "px"; }
        }

        // timer, record dot, ambient glow
        const sec = t < REC0 ? 0 : Math.min(3, Math.floor(t - REC0));
        const tm = "0:0" + sec;
        if ($("#timer").textContent !== tm) $("#timer").textContent = tm;
        $("#rdot").style.opacity = (0.55 + 0.45 * (0.5 + 0.5 * Math.cos(2 * Math.PI * (t - REC0)))).toFixed(3);
        const ramp = clamp((t - 1.3) / 0.4) * (1 - clamp((t - 5.1) / 0.5));
        $("#glow").style.opacity = (ramp * (0.16 + 0.4 * lvl(t))).toFixed(3);

        // player cards: playhead and played part
        const p1 = P1_END * clamp((t - P1_T0) / (P1_T1 - P1_T0));
        setProgress(cards[0], p1);
        setProgress(cards[1], P2);
        setProgress(cards[2], 0);
        $("#ph1").style.left = (p1 * PW).toFixed(1) + "px";
        $("#ph2").style.left = (P2 * PW).toFixed(1) + "px";
      }

      /* ---------- timeline ---------- */
      // Rule used throughout: initial hidden states live in CSS, one baseline tl.set for transforms, then .to() tweens with explicit end values.
      const tl = gsap.timeline({ paused: true });
      const DUR = 11;

      /* backdrop drift */
      [["#b1", 120, 70], ["#b2", -130, -60], ["#b3", 90, -50]].forEach((b) => {
        tl.to(b[0], { x: b[1], y: b[2], duration: DUR, ease: "sine.inOut" }, 0);
      });

      /* beat 1: cursor clicks the mic button, it expands into a live pill */
      tl.set("#cur", { x: 1480, y: 860 }, 0);
      tl.to("#cur", { opacity: 1, duration: 0.2, ease: "power1.out" }, 0.1);
      tl.to("#cur", { x: 972, y: 600, duration: 0.65, ease: "power3.inOut" }, 0.12);
      tl.to("#cur svg", { scale: 0.84, duration: 0.07, ease: "power2.out" }, 0.8);
      tl.to("#cur svg", { scale: 1, duration: 0.25, ease: "back.out(3)" }, 0.88);
      tl.to("#pill", { scale: 0.93, duration: 0.09, ease: "power2.out" }, 0.8);
      tl.to("#pill", { scale: 1, duration: 0.32, ease: "back.out(2.5)" }, 0.89);
      tl.to("#micw", { opacity: 0, duration: 0.25, ease: "power1.in" }, 0.95);
      tl.fromTo("#pill", { left: 880, top: 510, width: 160, height: 160, borderRadius: 80 }, { left: 410, top: 500, width: 1100, height: 180, borderRadius: 90, duration: 0.75, ease: "expo.inOut", immediateRender: false }, 0.95);
      tl.to("#pill", { borderColor: "rgba(255, 91, 69, 0.42)", duration: 0.5, ease: "power1.out" }, 1.4);
      tl.to("#cur", { x: 1500, y: 800, duration: 0.6, ease: "power2.inOut" }, 1.05);
      tl.to("#pc", { opacity: 1, duration: 0.35, ease: "power1.out" }, 1.3);
      tl.set("#stop", { scale: 0.6 }, 0);
      tl.to("#stop", { scale: 1, duration: 0.45, ease: "back.out(2.2)" }, 1.5);

      /* live transcript words */
      WORDS.forEach((w, i) => {
        const el = document.querySelectorAll("#tx .w")[i];
        const tr = w[1] + 0.14;
        tl.set(el, { y: 14 }, 0);
        tl.to(el, { opacity: 1, y: 0, duration: 0.3, ease: "power2.out" }, tr);
        tl.to(el, { color: "#f4f4f6", duration: 0.5, ease: "none" }, tr + 0.1);
      });

      /* stop click, the pill collapses into a note card */
      tl.to("#cur", { x: 1430, y: 600, duration: 0.55, ease: "power2.inOut" }, 4.45);
      tl.to("#cur svg", { scale: 0.84, duration: 0.07, ease: "power2.out" }, 5.05);
      tl.to("#cur svg", { scale: 1, duration: 0.25, ease: "back.out(3)" }, 5.12);
      tl.to("#stop", { scale: 0.88, duration: 0.08, ease: "power2.out" }, 5.05);
      tl.to("#cur", { opacity: 0, duration: 0.3, ease: "power1.in" }, 5.3);
      tl.to("#pc", { opacity: 0, duration: 0.3, ease: "power1.in" }, 5.15);
      tl.to("#tx", { opacity: 0, y: -26, duration: 0.4, ease: "power2.in" }, 5.25);
      tl.fromTo("#pill", { left: 410, top: 500, width: 1100, height: 180, borderRadius: 90 }, { left: 360, top: 154, width: 1200, height: 250, borderRadius: 38, duration: 0.8, ease: "power3.inOut", immediateRender: false }, 5.4);
      tl.to("#pill", { borderColor: "rgba(255, 255, 255, 0.1)", duration: 0.5, ease: "power1.out" }, 5.4);
      tl.set("#notec", { y: 14 }, 0);
      tl.to("#notec", { opacity: 1, y: 0, duration: 0.4, ease: "power2.out" }, 5.85);

      /* beat 2: audio player cards stack in under the note */
      [["#pc1", 6.0], ["#pc2", 6.18], ["#pc3", 6.36]].forEach((c) => {
        tl.set(c[0], { y: 64, scale: 0.97 }, 0);
        tl.to(c[0], { opacity: 1, y: 0, scale: 1, duration: 0.7, ease: "expo.out" }, c[1]);
      });
      // first card is played: play turns into pause, the playhead sweeps (computed in render)
      tl.to("#pc1 .pb", { scale: 0.9, duration: 0.08, ease: "power2.out" }, 6.65);
      tl.to("#pc1 .pb", { scale: 1, duration: 0.3, ease: "back.out(3)" }, 6.73);
      tl.to("#pc1 .pb", { backgroundColor: "#ff5b45", duration: 0.2, ease: "power1.out" }, 6.7);
      tl.to("#pc1 .pl", { opacity: 0, duration: 0.12, ease: "none" }, 6.7);
      tl.to("#pc1 .pa", { opacity: 1, duration: 0.12, ease: "none" }, 6.7);
      tl.to("#ph1", { opacity: 1, duration: 0.2, ease: "power1.out" }, 6.72);
      tl.to("#pc1", { borderColor: "rgba(255, 91, 69, 0.4)", duration: 0.4, ease: "power1.out" }, 6.7);

      /* clear the scene, then the lockup */
      tl.to("#scene", { opacity: 0, scale: 0.985, transformOrigin: "960px 540px", duration: 0.3, ease: "power2.in" }, 7.95);

      tl.set("#lmk", { scale: 0.7 }, 0);
      tl.set("#lmk i", { scaleY: 0.15 }, 0);
      tl.set("#lwm", { x: -30 }, 0);
      tl.set("#lsub", { y: 16 }, 0);
      tl.to("#lmk", { opacity: 1, scale: 1, duration: 0.45, ease: "expo.out" }, 8.3);
      tl.to("#lmk i", { scaleY: 1, duration: 0.4, ease: "back.out(2)", stagger: 0.03 }, 8.35);
      tl.to("#lwm", { opacity: 1, x: 0, duration: 0.45, ease: "expo.out" }, 8.35);
      tl.to("#lsub", { opacity: 1, y: 0, duration: 0.4, ease: "expo.out" }, 8.4);

      render(0);
      tl.to({ v: 0 }, { v: 1, duration: DUR, ease: "none", onUpdate: () => render(tl.time()) }, 0);
      window.addEventListener("hf-seek", (e) => render(e.detail.time));
      tl.set({}, {}, DUR);
      window.__timelines = window.__timelines || {};
      window.__timelines["main"] = tl;
    </script>
  </body>
</html>
```
