# Phone Mockup Animation

Motionboard shot name: Phone Pull-back

The film opens on a keyboard close-up as Draft a reply to Maya is typed and each key lights up. One long pull-back reveals a phone standing on a flat apricot field while the sent bubble lifts, a reply streams in and a draft email card appears. The phone turns a few degrees, slides left and the Tern lockup lands.

- Position in a launch film: Features
- Slug: phone-mockup-animation
- Preview video: https://media.motionboard.app/phone-pullback.mp4
- Recipe page: https://motionboard.app/recipes/phone-mockup-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 `phone-pullback`. 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 10.6s. Prompt typed 0.2–1.6s, one letter every 0.06–0.08s; close-up drifts 3.1x→3.16x over 0–1.8s; pull-back 1.8–3.8s (2.0s); shadow fades in 2.5–3.4s; send tap 3.3s; bubble lifts 3.4–4.1s; keyboard and composer slide down 3.55–4.15s; thinking dots 3.75–4.3s; reply lines at 4.2s and 4.4s; email card rises 4.65–5.25s, rows at 4.95s and 5.1s, four body lines from 5.3s every 0.17s, buttons from 6.0s; 3D turn 3.6–6.8s with a glare sweeping across the glass 3.7–6.6s; phone slides left and the turn eases back 7.15–8.15s; lockup 7.8–8.4s and holds still to the end (2.2s) |
| Easing | Pull-back uses power3.inOut on the progress, mapped to an exponential zoom (scale = 3.16 × (0.82 / 3.16)^progress) with x and y linear in scale; the close-up drift is linear (none); bubble lift, email card rise and lockup use expo.out; keyboard and composer slide use power3.inOut; reply lines, rows, body lines, buttons and tagline use power3.out; 3D turn uses power2.inOut and the glare sweep uses power1.inOut; the phone slide uses expo.inOut; key flashes use power2.out (0.03s down, 0.06s up) |
| Camera | One camera element scaled and translated, with perspective 1500px at the phone centre. Close-up 3.1x with the point 194px below the phone centre at the frame centre, so the phone body (600px × 3.16 = 1896px) fills the frame with about 12px of field at each side; pull-back to 0.82x with the phone centred at (960, 540), about 1000px tall; then the camera moves so the phone centre sits at x = 570. Phone turn: rotationY 0°→−18° and rotationX 0°→4° over 3.6–6.8s, then −6° and 1° at 8.15s |
| Subject | Generic phone built in CSS: 600x1220px body with 100px corners, a black bezel with a 5px silver rim, 12 slabs 4px apart behind the face for thickness, graded from rgb(224, 224, 230) at the face to rgb(147, 147, 153) at the back so the edge reads as lit metal, four 12px side buttons in #cfd0d6, a 572x1192px screen with 86px corners and a 160x46px camera pill. Screen: 9:41 status bar, Tern header, an empty state (What are we writing today? and two chips), a 524x96px composer with the placeholder Message Tern and a send circle, a 440px keyboard with 84px keys and 40px letters. Chat after sending: bubble Draft a reply to Maya at 38px, reply Here's a short, warm draft / you can send as is: at 35px, a 524px email card (To Maya Lindqvist, Subject Friday follow-up, four body lines at 33px, Copy, Edit and Send buttons). A 560x1200px shadow with a 46px blur sits behind the phone, and an 800x1192px glare band (100° gradient, white at 24% in the middle) sits over the glass. Lockup: a 150px ink mark with a white T, Tern at 176px and Your words, finished. at 52px |
| Sync | Each key flashes on the same frame its letter and cursor appear; the pull-back ends 0.5s after the send tap, and the bubble lifts 0.1s after the tap; the thinking dots start at 3.75s as the bubble settles and the first reply line arrives 0.45s later; the email card starts 0.25s after the second reply line, and its rows, body lines and buttons follow in order; the phone starts its turn at 3.6s, before the pull-back ends, with the glare band crossing the glass from 3.7s, and slides left at 7.15s, and the lockup enters at 7.8s only after the phone has cleared the right half of the frame |
| Style | One flat apricot field (radial gradient `#ffb36a` → `#fba14f` → `#f28f3c`), one orange accent `#f27a22` with a tint `#ffc891` for key flashes and a deeper `#c9560c` where white text sits on it; ink `#24160c`; white screen with a light keyboard; Inter throughout, wordmark weight 800; grain at 7% opacity re-rolled every 3 frames and a vignette reaching 26% at the edges |

## Why it works

The first frame is a close-up of the keyboard and the input field, so the viewer watches a prompt being typed with each key lighting up as its letter appears, and learns what the product does before seeing any device. The single pull-back then reveals that the close-up was a phone, and the reveal is a true zoom about one fixed point, so the phone appears to stand still while the camera backs away. The pull-back ends 0.5s after the send tap, so the answer happens while the camera settles: the bubble lifts out of the field, the keyboard drops away, the reply arrives line by line and a draft email card fills the screen. Chat text is scaled to 32–38px at design size so it still reads at the final 0.82x camera. A flat apricot field is the only colour behind the black phone, so the shape reads at once and the single orange accent carries the key lights, the cursor and the Send button. The slow 3D turn after the settle gives the flat screen a physical edge. The lockup waits until the phone has slid left, so nothing overlaps it.

## Prompt

> Build a 10.6-second, 1920x1080, 30 fps light product film called Phone Pull-back for a fictional product, Tern (an AI writing assistant). The background is a flat apricot field (radial gradient #ffb36a at the centre, #fba14f at 55%, #f28f3c at the edge), the one accent colour is orange #f27a22 (tint #ffc891 for key flashes, deeper #c9560c where white text sits on it), ink is #24160c, font Inter. Draw a generic phone in CSS with no brand marks: a 600x1220px body with 100px corners, a black bezel with a 5px silver rim, 12 slabs spaced 4px apart behind the face for thickness, graded from rgb(224, 224, 230) at the face to rgb(147, 147, 153) at the back, four 12px side buttons in #cfd0d6, a 572x1192px screen with 86px corners and a 160x46px camera pill. Put it in one camera element (transform-origin 0 0, perspective 1500px, perspective-origin at the phone centre) animated with x, y and scale; the phone inside it takes rotationX and rotationY. Screen contents: a 9:41 status bar, a header with the Tern mark, an empty state (What are we writing today? and two chips), a 524x96px composer with the placeholder Message Tern and a send circle, and a 440px keyboard with QWERTY keys 84px high and 40px letters. Shot: open on an extreme close-up at 3.1x on the composer and the first two key rows (the point 194px below the phone centre at the frame centre), drifting linearly to 3.16x over 0–1.8s. From 0.2s type Draft a reply to Maya, one letter every 0.06–0.08s; each letter appears with a cursor and its key flashes #ffc891 and scales to 0.93 (0.03s down, 0.06s up, never overlapping on the same key). Pull back over 1.8–3.8s to 0.82x with the phone centred at (960, 540), about 1000px tall: ease the progress with power3.inOut, compute scale = 3.16 × (0.82 / 3.16)^progress and move x and y linearly in scale, written as one custom ease function, so it is a true zoom about a fixed point. Fade in a shadow (560x1200px, 46px blur, 42% brown, offset 26px and 54px) over 2.5–3.4s. At 3.3s tap send (scale 0.86 and back); the bubble Draft a reply to Maya (38px, ink with white text) lifts out of the field from 430px below over 0.7s with expo.out; the keyboard and composer slide down 440px and 420px over 0.6s with power3.inOut; thinking dots pulse over 3.75–4.3s; the reply Here's a short, warm draft / you can send as is: (35px) fades in line by line at 4.2s and 4.4s from a 6px blur; a draft email card (524px wide, 30px corners, To Maya Lindqvist, Subject Friday follow-up, four body lines at 33px, Copy, Edit and Send buttons) rises at 4.65s with expo.out, its rows follow at 4.95s and 5.1s, the body lines every 0.17s from 5.3s and the buttons from 6.0s. Keep all chat text at 32px or more so it is at least 26px on screen at 0.82x. Turn the phone to rotationY −18° and rotationX 4° over 3.6–6.8s with power2.inOut, and sweep an 800x1192px glare band (100° gradient, 24% white in the middle, above the screen) from x = −800 to x = 572 over 3.7–6.6s with power1.inOut. At 7.15s move the camera over 1.0s (expo.inOut) so the phone centre goes to x = 570 and ease the turn to −6° and 1°. Lockup on the right, each element starting 40px to the right of its final spot and fading in: a 150px ink mark with a white T and a forked #ffc891 stem at 7.8s, Tern at 176px weight 800 at 7.85s, and Your words, finished. at 52px at 7.95s, still until 10.6s. Finish with 7% grain re-rolled every 3 frames and a vignette. Use one paused GSAP timeline, no CSS animations.

## Often confused with

- [Macro Pull-out Reveal](https://motionboard.app/r/macro-pull-out-reveal.md): Macro Pull-out Reveal drifts over a surface at extreme close range and pulls out to a device or page with shallow depth of field; in Phone Mockup Animation the close-up is a typed prompt on the keyboard, the pull-back shows a whole phone on a colour field, and the chat answers while the camera settles.
- [Chat Animation](https://motionboard.app/r/chat-animation.md): Chat Animation keeps the camera on a chat panel inside a window with tool-call cards and a preview beside it; in Phone Mockup Animation the chat lives on a phone, the camera pulls back from the keyboard to the whole device, and the answer is one reply and a draft email card.

## Source files

Runnable HyperFrames project, 3 files.

- https://motionboard.app/source/phone-pullback/hyperframes.json (353 B)
- https://motionboard.app/source/phone-pullback/index.html (25.5 KB)
- https://motionboard.app/source/phone-pullback/package.json (303 B)

Download all of them:

```sh
curl -fsSL --create-dirs -o "phone-pullback/hyperframes.json" "https://motionboard.app/source/phone-pullback/hyperframes.json"
curl -fsSL --create-dirs -o "phone-pullback/index.html" "https://motionboard.app/source/phone-pullback/index.html"
curl -fsSL --create-dirs -o "phone-pullback/package.json" "https://motionboard.app/source/phone-pullback/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 {
        --field: #fb9d4b;
        --accent: #f27a22;
        --accent-soft: #ffc891;
        --ink: #24160c;
        --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(--field); }
      #root {
        position: relative;
        width: 1920px;
        height: 1080px;
        overflow: hidden;
        background: var(--field);
        font-family: var(--font-ui);
        color: var(--ink);
        -webkit-font-smoothing: antialiased;
      }
      .full { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; }
      svg { display: block; flex: none; }

      /* ---------- colour field ---------- */
      #field {
        z-index: 1;
        background: radial-gradient(ellipse at 50% 42%, #ffb36a 0%, #fba14f 55%, #f28f3c 100%);
      }

      /* ---------- stage: camera + phone ---------- */
      #stage { z-index: 2; overflow: hidden; }
      #cam {
        position: absolute; left: 0; top: 0; width: 0; height: 0;
        transform-origin: 0 0;
        perspective: 1500px;
        perspective-origin: 0 0;
      }
      #shadow {
        position: absolute; left: -270px; top: -530px; width: 560px; height: 1200px;
        border-radius: 110px; background: rgba(120, 45, 0, 0.42); filter: blur(46px); opacity: 0;
      }
      #tilt {
        position: absolute; left: -300px; top: -610px; width: 600px; height: 1220px;
        transform-style: preserve-3d;
      }
      .slab {
        position: absolute; left: 0; top: 0; width: 600px; height: 1220px; border-radius: 100px;
        background: #b4b6be;
      }
      .sbtn { position: absolute; width: 12px; border-radius: 5px; background: #cfd0d6; transform: translateZ(-16px); }
      #body {
        position: absolute; left: 0; top: 0; width: 600px; height: 1220px; border-radius: 100px;
        background: #0a0a0c;
        box-shadow: inset 0 0 0 5px #6d6e75, inset 0 0 0 9px #1c1c20;
      }
      #screen {
        position: absolute; left: 14px; top: 14px; width: 572px; height: 1192px; border-radius: 86px;
        overflow: hidden; background: #ffffff;
      }
      #glare {
        position: absolute; left: 0; top: 0; width: 800px; height: 1192px; z-index: 40; pointer-events: none;
        background: linear-gradient(100deg, rgba(255, 255, 255, 0) 36%, rgba(255, 255, 255, 0.24) 50%, rgba(255, 255, 255, 0) 64%);
      }
      #island {
        position: absolute; left: 206px; top: 16px; width: 160px; height: 46px; border-radius: 23px;
        background: #050506; z-index: 20;
      }
      #island::after {
        content: ""; position: absolute; right: 16px; top: 15px; width: 16px; height: 16px; border-radius: 50%;
        background: radial-gradient(circle at 35% 35%, #2b2f4a, #0b0c14 70%);
      }

      /* status bar + header */
      #sb { position: absolute; left: 0; top: 0; width: 572px; height: 88px; z-index: 10; }
      #sb .time { position: absolute; left: 54px; top: 22px; font-size: 31px; font-weight: 600; color: #111; letter-spacing: -0.01em; }
      #sb .ic { position: absolute; right: 46px; top: 28px; display: flex; gap: 10px; align-items: center; }
      #hdr {
        position: absolute; left: 0; top: 92px; width: 572px; height: 88px;
        border-bottom: 2px solid #f1ede8; background: #fff; z-index: 5;
      }
      #hdr .l { position: absolute; left: 30px; top: 30px; }
      #hdr .r { position: absolute; right: 30px; top: 26px; }
      #hdr .c { position: absolute; left: 0; top: 0; width: 572px; height: 88px; display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 34px; font-weight: 700; letter-spacing: -0.02em; }

      /* empty state */
      #empty { position: absolute; left: 0; top: 212px; width: 572px; text-align: center; }
      #empty .mk { width: 84px; height: 84px; margin: 0 auto; }
      #empty h2 { margin-top: 24px; font-size: 44px; line-height: 52px; font-weight: 700; letter-spacing: -0.02em; }
      #empty .chip {
        display: block; width: max-content; margin: 12px auto 0; height: 62px; line-height: 58px; padding: 0 28px;
        border: 2px solid #e8e1da; border-radius: 31px; font-size: 31px; font-weight: 500; color: #4a4038;
      }
      #empty .chip:first-of-type { margin-top: 26px; }

      /* chat */
      #bubble {
        position: absolute; right: 24px; top: 204px; max-width: 524px; padding: 20px 30px;
        border-radius: 38px 38px 10px 38px; background: #24160c; color: #fff;
        font-size: 38px; line-height: 50px; font-weight: 500; letter-spacing: -0.01em; opacity: 0; }
      #rlabel { position: absolute; left: 24px; top: 312px; height: 48px; display: flex; align-items: center; gap: 12px; font-size: 30px; font-weight: 700; color: #3a2f27; opacity: 0; }
      #dots { position: absolute; left: 32px; top: 388px; display: flex; gap: 10px; opacity: 0; }
      #dots i { display: block; width: 14px; height: 14px; border-radius: 50%; background: #b9aea3; opacity: 0.3; }
      #rtext { position: absolute; left: 24px; top: 372px; width: 524px; }
      .rl { height: 46px; line-height: 46px; font-size: 35px; font-weight: 500; color: #2b2520; white-space: nowrap; opacity: 0; }
      #card {
        position: absolute; left: 24px; top: 482px; width: 524px; border-radius: 30px; background: #fff;
        border: 2px solid #ecdfd3; box-shadow: 0 16px 34px rgba(140, 70, 10, 0.14); overflow: hidden; opacity: 0;
      }
      .ch { height: 68px; display: flex; align-items: center; gap: 12px; padding: 0 24px; background: #fff1e3; font-size: 32px; font-weight: 700; color: #3a2a1c; }
      .ch .tag { margin-left: auto; font-size: 30px; font-weight: 600; color: #b84e0a; }
      .cr { height: 60px; display: flex; align-items: center; padding: 0 24px; font-size: 32px; border-bottom: 2px solid #f3ece5; opacity: 0; }
      .cr b { width: 144px; font-weight: 500; color: #7f746a; }
      .cr span { font-weight: 600; color: #2b2520; }
      #cbody { padding: 20px 24px 8px; }
      .cb { height: 46px; line-height: 46px; font-size: 33px; font-weight: 400; color: #2b2520; white-space: nowrap; opacity: 0; }
      #cact { display: flex; gap: 12px; padding: 12px 24px 24px; }
      .ca {
        height: 60px; padding: 0 28px; border-radius: 30px; font-size: 32px; font-weight: 600; line-height: 56px;
        border: 2px solid #e6d9cc; color: #3a2a1c; opacity: 0;
      }
      .ca.pri { margin-left: auto; background: #c9560c; border-color: #c9560c; color: #fff; }

      /* composer */
      #composer { position: absolute; left: 24px; top: 640px; width: 524px; height: 96px; z-index: 8; }
      #fieldbox { position: absolute; left: 0; top: 0; width: 524px; height: 96px; border-radius: 48px; background: #f4f1ed; border: 2px solid #ece6df; }
      #ph { position: absolute; left: 34px; top: 0; height: 92px; line-height: 92px; font-size: 32px; font-weight: 400; color: #7a7066; }
      #typed { position: absolute; left: 34px; top: 0; height: 92px; line-height: 92px; font-size: 32px; font-weight: 500; color: #1c1612; white-space: pre; }
      #typed .c { position: relative; opacity: 0; }
      #typed .c .cur { position: absolute; right: -3px; top: 22px; width: 3px; height: 46px; background: var(--accent); opacity: 0; border-radius: 2px; }
      #typed .c0 { position: absolute; left: 0; top: 22px; width: 3px; height: 46px; background: var(--accent); border-radius: 2px; }
      #sendbtn { position: absolute; right: 12px; top: 12px; width: 68px; height: 68px; border-radius: 50%; background: #8f857b; display: flex; align-items: center; justify-content: center; }

      #home { position: absolute; left: 186px; top: 1166px; width: 200px; height: 8px; border-radius: 4px; background: #1a1a1c; z-index: 7; }

      /* keyboard */
      #kb { position: absolute; left: 0; top: 752px; width: 572px; height: 440px; background: #d3d5db; z-index: 9; }
      #kb .row { position: absolute; left: 8px; right: 8px; height: 84px; display: flex; gap: 8px; }
      .key {
        flex: 1; height: 84px; border-radius: 14px; background: #ffffff; box-shadow: 0 3px 0 #8d9098;
        display: flex; align-items: center; justify-content: center;
        font-size: 40px; font-weight: 500; color: #111; letter-spacing: 0;
      }
      .key.sp { background: #adb1ba; font-size: 26px; font-weight: 600; }
      #kbhome { position: absolute; left: 186px; top: 414px; width: 200px; height: 8px; border-radius: 4px; background: #1a1a1c; }

      /* ---------- lockup ---------- */
      #lockup { z-index: 3; }
      #lkmark { position: absolute; left: 986px; top: 417px; width: 150px; height: 150px; opacity: 0; }
      #lkword { position: absolute; left: 1168px; top: 391px; font-size: 176px; line-height: 200px; font-weight: 800; letter-spacing: -0.05em; color: var(--ink); opacity: 0; white-space: nowrap; }
      #lktag { position: absolute; left: 990px; top: 617px; font-size: 52px; line-height: 64px; font-weight: 500; letter-spacing: -0.01em; color: rgba(36, 22, 12, 0.78); opacity: 0; white-space: nowrap; }

      /* ---------- finish ---------- */
      #grain {
        z-index: 4; pointer-events: none; opacity: 0.07;
        background-size: 256px 256px;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='256' height='256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='256' height='256' filter='url(%23n)'/%3E%3C/svg%3E");
      }
      #vig {
        z-index: 5; pointer-events: none;
        background: radial-gradient(ellipse at center, rgba(150, 60, 0, 0) 58%, rgba(150, 60, 0, 0.26) 100%);
      }
    </style>
  </head>
  <body>
    <div id="root" data-composition-id="main" data-start="0" data-duration="10.6" data-width="1920" data-height="1080">
      <div id="field" class="clip full" data-start="0" data-duration="10.6" data-track-index="0"></div>

      <div id="stage" class="clip full" data-start="0" data-duration="10.6" data-track-index="1">
        <div id="cam" data-layout-allow-overlap>
          <div id="shadow"></div>
          <div id="tilt" data-layout-allow-overlap>
            <div class="sbtn" style="left:-7px; top:236px; height:84px"></div>
            <div class="sbtn" style="left:-7px; top:344px; height:84px"></div>
            <div class="sbtn" style="left:-7px; top:170px; height:40px"></div>
            <div class="sbtn" style="right:-7px; top:320px; height:150px"></div>
            <div id="body" data-layout-allow-overlap>
              <div id="screen" data-layout-allow-overlap>
                <div id="island"></div>
                <div id="glare"></div>

                <div id="sb">
                  <span class="time">9:41</span>
                  <div class="ic">
                    <svg width="34" height="22" viewBox="0 0 34 22" fill="#111"><rect x="0" y="14" width="6" height="8" rx="2"/><rect x="9" y="9" width="6" height="13" rx="2"/><rect x="18" y="4" width="6" height="18" rx="2"/><rect x="27" y="0" width="6" height="22" rx="2"/></svg>
                    <svg width="32" height="24" viewBox="0 0 32 24" fill="none" stroke="#111" stroke-width="3.4" stroke-linecap="round"><path d="M3 9a19 19 0 0 1 26 0"/><path d="M8 14.5a12 12 0 0 1 16 0"/><circle cx="16" cy="20" r="1.8" fill="#111" stroke="none"/></svg>
                    <svg width="50" height="24" viewBox="0 0 50 24" fill="none"><rect x="1.5" y="1.5" width="42" height="21" rx="7" stroke="#111" stroke-opacity="0.45" stroke-width="3"/><rect x="5" y="5" width="35" height="14" rx="4" fill="#111"/><rect x="46" y="8" width="3" height="8" rx="1.5" fill="#111" fill-opacity="0.45"/></svg>
                  </div>
                </div>

                <div id="hdr">
                  <div class="l"><svg width="32" height="28" viewBox="0 0 32 28" fill="none" stroke="#24160c" stroke-width="3.4" stroke-linecap="round"><path d="M3 7h26M3 21h16"/></svg></div>
                  <div class="c"><span id="hmark"></span><span>Tern</span></div>
                  <div class="r"><svg width="36" height="36" viewBox="0 0 36 36" fill="none" stroke="#24160c" stroke-width="3.2" stroke-linecap="round" stroke-linejoin="round"><path d="M16 6H8a3 3 0 0 0-3 3v19a3 3 0 0 0 3 3h19a3 3 0 0 0 3-3V20"/><path d="M27 4l5 5-14 14-6 1 1-6z"/></svg></div>
                </div>

                <div id="empty">
                  <div class="mk" id="emark"></div>
                  <h2>What are we<br />writing today?</h2>
                  <span class="chip">Reply to an email</span>
                  <span class="chip">Polish a draft</span>
                </div>

                <div id="bubble">Draft a reply to Maya</div>

                <div id="rlabel"><span id="rmark"></span><span>Tern</span></div>
                <div id="dots"><i></i><i></i><i></i></div>
                <div id="rtext">
                  <div class="rl" id="rl1">Here's a short, warm draft</div>
                  <div class="rl" id="rl2">you can send as is:</div>
                </div>

                <div id="card" data-layout-allow-overlap>
                  <div class="ch">
                    <svg width="32" height="32" viewBox="0 0 32 32" fill="none" stroke="#f27a22" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="6" width="26" height="20" rx="5"/><path d="M5 10l11 8 11-8"/></svg>
                    <span>Draft email</span><span class="tag">Tern</span>
                  </div>
                  <div class="cr" id="cr1"><b>To</b><span>Maya Lindqvist</span></div>
                  <div class="cr" id="cr2"><b>Subject</b><span>Friday follow-up</span></div>
                  <div id="cbody">
                    <div class="cb">Hi Maya, thanks for the</div>
                    <div class="cb">Friday walkthrough. I'll</div>
                    <div class="cb">send notes by Monday and</div>
                    <div class="cb">set up a call. &mdash; Priya</div>
                  </div>
                  <div id="cact">
                    <span class="ca">Copy</span>
                    <span class="ca">Edit</span>
                    <span class="ca pri">Send</span>
                  </div>
                </div>

                <div id="composer">
                  <div id="fieldbox">
                    <span id="ph">Message Tern</span>
                    <div id="typed"><i class="c0" id="cur0"></i></div>
                    <div id="sendbtn"><svg width="30" height="30" viewBox="0 0 30 30" fill="none" stroke="#fff" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"><path d="M15 25V6M6 14l9-9 9 9"/></svg></div>
                  </div>
                </div>

                <div id="home"></div>
                <div id="kb"><div id="kbhome"></div></div>
              </div>
            </div>
          </div>
        </div>
      </div>

      <div id="lockup" class="clip full" data-start="0" data-duration="10.6" data-track-index="2" data-layout-allow-overlap>
        <div id="lkmark"></div>
        <div id="lkword">Tern</div>
        <div id="lktag">Your words, finished.</div>
      </div>

      <div id="grain" class="clip full" data-start="0" data-duration="10.6" data-track-index="3" data-layout-ignore></div>
      <div id="vig" class="clip full" data-start="0" data-duration="10.6" data-track-index="4" data-layout-ignore></div>
    </div>

    <script>
      /* ---------- static build (no animation) ---------- */
      const ACC = "#f27a22";
      const ACC_SOFT = "#ffc891";
      const ACC_DEEP = "#c9560c";
      const mark = (bg, fork) =>
        '<svg viewBox="0 0 120 120" width="100%" height="100%"><rect width="120" height="120" rx="30" fill="' + bg + '"/>' +
        '<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="12">' +
        '<path d="M32 40H88M60 40V66" stroke="#ffffff"/><path d="M60 66L42 90M60 66L78 90" stroke="' + fork + '"/></g></svg>';
      const put = (id, html, size) => {
        const el = document.getElementById(id);
        el.innerHTML = html;
        if (size) { el.style.display = "inline-block"; el.style.width = size + "px"; el.style.height = size + "px"; }
      };
      put("hmark", mark("#24160c", ACC), 40);
      put("rmark", mark("#24160c", ACC), 44);
      put("emark", mark(ACC, "#24160c"));
      put("lkmark", mark("#24160c", ACC_SOFT));

      // thickness of the phone: stacked slabs behind the front face
      (function () {
        const tilt = document.getElementById("tilt");
        for (let i = 12; i >= 1; i--) {
          const d = document.createElement("div");
          d.className = "slab";
          d.style.transform = "translateZ(" + -i * 4 + "px)";
          const g = Math.round(224 - (i - 1) * 7); // lit at the face, darker toward the back
          d.style.background = "rgb(" + g + "," + g + "," + (g + 6) + ")";
          tilt.insertBefore(d, tilt.firstChild);
        }
      })();

      // keyboard
      const keyEl = {};
      (function () {
        const kb = document.getElementById("kb");
        const mk = (label, extra, flex) => {
          const k = document.createElement("div");
          k.className = "key" + (extra ? " " + extra : "");
          if (flex) k.style.flex = String(flex);
          k.innerHTML = label;
          return k;
        };
        const row = (top, left, right) => {
          const r = document.createElement("div");
          r.className = "row";
          r.style.top = top + "px";
          if (left !== undefined) r.style.left = left + "px";
          if (right !== undefined) r.style.right = right + "px";
          kb.appendChild(r);
          return r;
        };
        const addLetters = (r, str) => str.split("").forEach((ch) => { const k = mk(ch); keyEl[ch] = k; r.appendChild(k); });
        addLetters(row(22, 8, 8), "QWERTYUIOP");
        const r2 = row(120, 36, 36);
        addLetters(r2, "ASDFGHJKL");
        const r3 = row(218);
        r3.appendChild(mk('<svg width="32" height="30" viewBox="0 0 32 30" fill="#111"><path d="M16 2L3 16h8v11h10V16h8z"/></svg>', "sp", 1.45));
        addLetters(r3, "ZXCVBNM");
        r3.appendChild(mk('<svg width="38" height="30" viewBox="0 0 38 30" fill="none" stroke="#111" stroke-width="3" stroke-linejoin="round"><path d="M13 3h21a2 2 0 0 1 2 2v20a2 2 0 0 1-2 2H13L2 15z"/><path d="M19 10l10 10M29 10L19 20" stroke-linecap="round"/></svg>', "sp", 1.45));
        const r4 = row(316);
        r4.appendChild(mk("123", "sp", 2.3));
        const sp = mk("space", "", 6); sp.style.fontSize = "26px"; sp.style.fontWeight = "500"; sp.style.color = "#777";
        keyEl[" "] = sp; r4.appendChild(sp);
        r4.appendChild(mk("return", "sp", 2.7));
      })();

      // typed text: one span per character, each carrying its own cursor
      const PROMPT = "Draft a reply to Maya";
      const typed = document.getElementById("typed");
      const charEls = PROMPT.split("").map((ch) => {
        const s = document.createElement("span");
        s.className = "c";
        s.textContent = ch;
        const cur = document.createElement("i");
        cur.className = "cur";
        s.appendChild(cur);
        typed.appendChild(s);
        return s;
      });

      /* ---------- timeline ---------- */
      const DUR = 10.6;
      const tl = gsap.timeline({ paused: true });

      /* camera: slow push during typing, then one long eased pull-back.
         Scale and position share one ease (exponential zoom, position linear in scale),
         so the move is a true zoom about a fixed point. */
      const FOCUS_Y = 194; // phone-space y kept at screen centre in the close-up
      const S_A = 3.1, S_B = 3.16, S_END = 0.82;
      const PULL_AT = 1.8, PULL_DUR = 2.0;
      const e3io = (p) => (p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2);
      const zoomEase = (p) => {
        const e = e3io(p);
        const s = S_B * Math.pow(S_END / S_B, e);
        return (s - S_B) / (S_END - S_B);
      };

      // baselines (hidden states live in CSS as opacity 0)
      gsap.set("#cam", { x: 960, y: 540 - S_A * FOCUS_Y, scale: S_A });
      gsap.set("#shadow", { x: 26, y: 54 });
      gsap.set("#tilt", { rotationY: 0, rotationX: 0 });
      gsap.set("#glare", { x: -800 });
      gsap.set("#bubble", { y: 430, scale: 0.92, transformOrigin: "100% 100%" });
      gsap.set("#rlabel", { y: 8 });
      gsap.set(".rl", { y: 12, filter: "blur(6px)" });
      gsap.set("#card", { y: 36, scale: 0.96, transformOrigin: "50% 0%" });
      gsap.set(".cr, .cb", { y: 8 });
      gsap.set(".ca", { y: 10 });
      gsap.set("#lkmark", { x: 40, scale: 0.9, transformOrigin: "50% 50%" });
      gsap.set("#lkword", { x: 40, filter: "blur(10px)" });
      gsap.set("#lktag", { x: 40 });

      tl.to("#cam", { y: 540 - S_B * FOCUS_Y, scale: S_B, duration: PULL_AT, ease: "none" }, 0);
      tl.to("#cam", { x: 960, y: 540, scale: S_END, duration: PULL_DUR, ease: zoomEase }, PULL_AT);

      // shadow appears once the phone is small enough to stand on the field
      tl.to("#shadow", { opacity: 1, duration: 0.9, ease: "power2.out" }, 2.5);

      // 3D turn after the pull-back, easing back a little as the phone makes room for the lockup
      tl.to("#tilt", { rotationY: -18, rotationX: 4, duration: 3.2, ease: "power2.inOut" }, 3.6);
      tl.to("#glare", { x: 572, duration: 2.9, ease: "power1.inOut" }, 3.7);
      tl.to("#tilt", { rotationY: -6, rotationX: 1, duration: 1.0, ease: "power2.inOut" }, 7.15);
      tl.to("#cam", { x: 570, duration: 1.0, ease: "expo.inOut" }, 7.15);

      /* typing: keys light up as the letters appear.
         Press (0.03) and release (0.06) end 0.10 s after the keystroke; the same key is never hit twice within 0.11 s. */
      let t = 0.2;
      PROMPT.split("").forEach((ch, i) => {
        const key = keyEl[ch === " " ? " " : ch.toUpperCase()];
        if (i === 0) {
          tl.set("#ph", { opacity: 0 }, t);
          tl.to("#sendbtn", { backgroundColor: ACC_DEEP, duration: 0.18, ease: "power2.out" }, t);
        }
        tl.set(charEls[i], { opacity: 1 }, t);
        tl.set(charEls[i].lastElementChild, { opacity: 1 }, t);
        if (i > 0) tl.set(charEls[i - 1].lastElementChild, { opacity: 0 }, t);
        tl.to(key, { backgroundColor: ACC_SOFT, scale: 0.93, duration: 0.03, ease: "power2.out" }, t);
        tl.to(key, { backgroundColor: "#ffffff", scale: 1, duration: 0.06, ease: "power2.out" }, t + 0.04);
        t += 0.06 + 0.018 * ((i * 5) % 3) / 2;
      });
      // steady cursor before the first key
      tl.set("#cur0", { opacity: 0 }, 0.2);

      /* send, keyboard leaves, the sent bubble lifts, the reply is streamed */
      const SEND = 3.3;
      tl.to("#sendbtn", { scale: 0.86, duration: 0.07, ease: "power2.out" }, SEND);
      tl.to("#sendbtn", { scale: 1, backgroundColor: "#8f857b", duration: 0.25, ease: "power3.out" }, SEND + 0.07);
      tl.set("#typed", { opacity: 0 }, SEND + 0.1);
      tl.to("#ph", { opacity: 1, duration: 0.25, ease: "power2.out" }, SEND + 0.2);

      tl.to("#empty", { opacity: 0, y: -14, duration: 0.35, ease: "power2.in" }, SEND + 0.05);
      tl.to("#bubble", { opacity: 1, y: 0, scale: 1, duration: 0.7, ease: "expo.out" }, SEND + 0.1);

      tl.to("#kb", { y: 440, duration: 0.6, ease: "power3.inOut" }, SEND + 0.25);
      tl.to("#composer", { y: 420, duration: 0.6, ease: "power3.inOut" }, SEND + 0.25);

      // thinking dots right after the bubble lands
      tl.to("#rlabel", { opacity: 1, y: 0, duration: 0.3, ease: "power3.out" }, 3.7);
      tl.to("#dots", { opacity: 1, duration: 0.12, ease: "power1.out" }, 3.75);
      document.querySelectorAll("#dots i").forEach((d, i) => {
        for (let c = 0; c < 2; c++) {
          const at = 3.75 + c * 0.22 + i * 0.06;
          tl.to(d, { opacity: 1, duration: 0.1, ease: "power1.out" }, at);
          tl.to(d, { opacity: 0.3, duration: 0.1, ease: "power1.in" }, at + 0.11);
        }
      });
      tl.to("#dots", { opacity: 0, duration: 0.1, ease: "power1.in" }, 4.2);

      // streamed reply, line by line
      tl.to("#rl1", { opacity: 1, y: 0, filter: "blur(0px)", duration: 0.4, ease: "power3.out" }, 4.2);
      tl.to("#rl2", { opacity: 1, y: 0, filter: "blur(0px)", duration: 0.4, ease: "power3.out" }, 4.4);

      // draft email card
      tl.to("#card", { opacity: 1, y: 0, scale: 1, duration: 0.6, ease: "expo.out" }, 4.65);
      tl.to("#cr1", { opacity: 1, y: 0, duration: 0.3, ease: "power3.out" }, 4.95);
      tl.to("#cr2", { opacity: 1, y: 0, duration: 0.3, ease: "power3.out" }, 5.1);
      document.querySelectorAll(".cb").forEach((el, i) => {
        tl.to(el, { opacity: 1, y: 0, duration: 0.32, ease: "power3.out" }, 5.3 + i * 0.17);
      });
      document.querySelectorAll(".ca").forEach((el, i) => {
        tl.to(el, { opacity: 1, y: 0, duration: 0.3, ease: "power3.out" }, 6.0 + i * 0.09);
      });

      /* lockup: starts right of its final spot, enters after the phone has cleared (phone right edge < 860 by 7.8),
         settled by 8.4, still for 2.2 s */
      tl.to("#lkmark", { opacity: 1, x: 0, scale: 1, duration: 0.6, ease: "expo.out" }, 7.8);
      tl.to("#lkword", { opacity: 1, x: 0, filter: "blur(0px)", duration: 0.55, ease: "expo.out" }, 7.85);
      tl.to("#lktag", { opacity: 1, x: 0, duration: 0.45, ease: "power3.out" }, 7.95);

      /* grain: tile offset re-rolled every 3 frames */
      for (let f = 0; f < DUR * 30; f += 3) {
        const ox = (f * 97) % 256;
        const oy = (f * 61 + 37 * (f % 5)) % 256;
        tl.set("#grain", { backgroundPosition: ox + "px " + oy + "px" }, f / 30);
      }

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