# One Headline Reflowing Across Widths (同一标题在不同宽度换行)

A hairline frame narrows from 1440 to 390 while the headline genuinely rewraps, drops one size at the breakpoint, and ends beside the desktop version; explains responsive layout in one scene.

- Ref: `video/motion-text-responsive-reflow` (code video · motion · launch, feature, tutorial · any · 6s at 30fps)
- Page: https://uifino.com/en/videos/motion-text-responsive-reflow
- Markdown: https://uifino.com/md/videos/motion-text-responsive-reflow.md
- Preview image: https://uifino.com/videos/motion-text-responsive-reflow/poster.jpg

## Install

- ZIP: https://uifino.com/videos/motion-text-responsive-reflow/source.zip

A hairline frame narrows from 1440 to 390 while the headline genuinely rewraps, drops one size at the breakpoint, and ends beside the desktop version; explains responsive layout in one scene.

Rendered video: https://uifino.com/videos/motion-text-responsive-reflow/preview.mp4

## Beats

- 0-0.5s Show the headline at desktop width: A 1440 px hairline frame, one 72 px line, ruler reads 1440 Camera: static. On-screen text: "Give your AI the design reference and it builds the same thing".
- 0.5-2.1s Show that rewrapping is real layout by narrowing continuously: Frame 1440 to 390 on power2.inOut with real rewrapping; at 1.421 s it crosses 768 and the size drops 72 to 48 px over 0.2 s; ruler number follows the live width Camera: static.
- 2.1-2.6s Read the three-line phone headline: 390 px wide, three lines, fully still Camera: static.
- 2.6-3.7s Bring both widths into one view: The stage scales to 0.8 and the phone frame moves right 780 px; from 3.1 s the desktop frame wipes open left to right with clip-path Camera: zoom out. Transition: scale and slide.
- 3.7-6s Hold the side-by-side comparison: Desktop 1440 on one line beside phone 390 on three, each labelled, still for 2.3 s Camera: static.

## Parameters

- `headline` Headline: default 把设计参考交给 AI，它就能照着做出来
- `accentColor` Width number color: default #2F5BFF
- `ink` Headline color: default #1C1C1A
- `muted` Ruler color: default #6E6C66
- `line` Frame line color: default #BDB9AE
- `bg` Background: default #E8E6E1
- `startWidth` Start width: default 1440px, range 1200 to 1600px
- `endWidth` End width: default 390px, range 320 to 480px
- `breakpoint` Breakpoint for the size drop: default 768px, range 500 to 1000px
- `bigSize` Size above the breakpoint: default 72px, range 56 to 88px
- `smallSize` Size below the breakpoint: default 48px, range 32 to 64px
- `narrowAt` Narrowing start: default 0.5s, range 0.3 to 1s
- `narrowDuration` Narrowing duration: default 1.6s, range 1 to 2.2s
- `sizeSwapDuration` Size drop duration: default 0.2s, range 0.1 to 0.4s
- `compareAt` Side-by-side start: default 2.6s, range 2.4 to 3.1s

## Good for

- Explaining responsive or adaptive layout of a site or design tool
- A launch or site segment that shows one content fitting several screens
- Headlines of 15 to 25 Chinese characters or 8 to 14 English words

## Not for

- Showing a real product interface
- More than two widths side by side
- Headlines longer than 4 lines

## Source files (plain text)

- https://uifino.com/videos/motion-text-responsive-reflow/source/SPEC.md
- https://uifino.com/videos/motion-text-responsive-reflow/source/PROMPT.md
- https://uifino.com/videos/motion-text-responsive-reflow/source/NOTICE.md
- https://uifino.com/videos/motion-text-responsive-reflow/source/project/assets/fonts/OFL.txt
- https://uifino.com/videos/motion-text-responsive-reflow/source/project/compositions/reflow.html
- https://uifino.com/videos/motion-text-responsive-reflow/source/project/hyperframes.json
- https://uifino.com/videos/motion-text-responsive-reflow/source/project/index.html

## How to use

- Copy the beats and parameters; replace only the copy, the accent color and the product screenshots.
- `PROMPT.md` has two prompts: one to reproduce this video exactly, one to learn only the technique.
- Build with HyperFrames (`/hyperframes`); the project in the ZIP is a ready starting point.

## Files

| Path | Role | Size |
| :--- | :--- | ---: |
| PROMPT.md | doc | 3.3 KB |
| SPEC.md | doc | 8.4 KB |

### PROMPT.md

```md
# PROMPT：motion-text-responsive-reflow

## 照抄复刻
用 `/hyperframes` 做一条 1920×1080、30 fps、6 秒的动效：一个只有细线框的版面从桌面宽度连续收窄到手机宽度，标题由浏览器按当前宽度真实重新换行，最后桌面版和手机版并排。

1. 画面：底色 `#E8E6E1`；标题 `#1C1C1A`，字重 600、字距 -0.01em、行高 1.25、`text-wrap: balance`；中文用 Noto Sans SC，西文和数字用 Schibsted Grotesk，本地 `@font-face`。字号只有 72px 和 48px 两档，量尺数字 36px。没有手机机身、刘海、浏览器顶栏和圆点，没有阴影和渐变。
2. 框：高 640，1px `#BDB9AE` 线，内边距上 56、左右 48，0 圆角；框内标题贴上沿，贴底有一个高 160、左右各 48、1px 线、8px 圆角的空占位块。框顶 y=200，水平居中在 x=960。框下 32px 处是 1px `#6E6C66` 量尺线，两端各一条 17px 高的刻度，量尺线下 20px 居中写宽度数字，强调色 `#2F5BFF`。
3. 文案：「把设计参考交给 AI，它就能照着做出来」。英文：Give your AI the design reference and it builds the same thing。
4. 节拍：0 – 0.5 秒 1440 宽，标题单行；0.5 – 2.1 秒框宽 1440 到 390，一条补间，1.6 秒 `power2.inOut`，直接补间容器 `width`，标题让浏览器真实换行（不要做两张图交叉淡化，不要把标题裁切或溢出框外）；2.1 – 2.6 秒停在 390；2.6 – 3.5 秒并排移动；3.7 – 6.0 秒并排停留 2.3 秒。
5. 断点：框宽跨过 768 的时刻（用补间曲线反推：进度 0.64，补间 0.5757，起点 1.421 秒）字号 72px 到 48px，0.2 秒 `power2.inOut`。字号用 CSS 变量 `--fs` 做补间，不要补间 `fontSize`。
6. 量尺数字：只有一个，是框宽的实时读数。把 CSS 变量 `--w`（数值）和 `width` 放在同一条补间里（1440 到 390），数字用 `counter-reset: w round(var(--w))` 加 `::after { content: counter(w) }` 显示。
7. 并排：同一个舞台（原点 960,540）0.9 秒 `power2.inOut` 缩到 0.8 倍，手机框同时右移 780px；左边那个桌面框（宽 1440、标题 72px 单行，也是真实排版）3.1 – 3.7 秒用 `clip-path` 从左往右展开（0.6 秒 `power3.out`；要等手机框挪开再展开，否则两个标题叠在一起），它的量尺 3.4 – 3.7 秒淡入。最终桌面框屏幕坐标 x 180 – 1332，手机框 x 1428 – 1740。
8. 禁止：标签、步骤号、弹跳、呼吸漂浮、第二种强调色。

需要替换的地方（在 `index.html` 里 `id="reflow"` 的挂载元素上写 `data-variable-values` 传入，换别的中文文案后要重新生成字体子集）：
- 文案：`headline`。
- 颜色：`accentColor`、`ink`、`muted`、`line`、`bg`。
- 宽度和字号：`startWidth`（1440）、`endWidth`（390）、`breakpoint`（768）、`bigSize`（72）、`smallSize`（48）；量尺数字自动跟随框宽。
- 时间：`narrowAt`（0.5）、`narrowDuration`（1.6）、`sizeSwapDuration`（0.2）、`compareAt`（2.6）。

## 只学手法
让容器宽度连续变化，用浏览器真实排版换行说明响应式，不要用图片交叉淡化：容器 1440 到 390，1.6 秒 `power2.inOut`，宽度每过一个断点字号降一档（768 处 72px 到 48px，0.2 秒），最后用同一份文案并排两种宽度，各自标注宽度，并排停留不少于 2 秒。
```

### SPEC.md

```md
# SPEC：motion-text-responsive-reflow

## LOOK
- 色值（中性色 4 个，强调色 1 个）：底 `#E8E6E1`，标题字 `#1C1C1A`，量尺线 `#6E6C66`，框线 `#BDB9AE`（比 BRIEF 的 `#D3D0C8` 略深，对底 `#E8E6E1` 约 1.7:1，仍是淡线，但手机上看得清框在收窄），强调色 `#2F5BFF`（只染宽度数字，面积不到 1%）。
- 字体：中文 Noto Sans SC，西文和数字 Schibsted Grotesk，本地 `@font-face`（`assets/fonts/noto-sans-sc.woff2`、`schibsted-grotesk.woff2`），门禁按用到的字生成子集，OFL 许可。西文排在前，中文兜底。BRIEF 要求「小号等宽数字」，手册的精选字体里没有等宽字体，改用 Schibsted Grotesk 的 `tabular-nums`（等宽数字），字距 0.04em。
- 字号（3 档）：标题 72px（宽度高于 768 时）和 48px（低于 768 时），字重 600，字距 -0.01em，行高 1.25；宽度数字 36px，字重 500。最后并排时整体缩到 0.8 倍，数字实际约 29px，标题 57.6px 和 38.4px，都不低于 28px。
- 圆角：只有一档 8px，给框内的空白占位块；框本身 0 圆角，没有机身、刘海、顶栏和圆点。
- 线：全部 1px。框和占位块用 `#BDB9AE`，量尺线和两端 17px 高的刻度用 `#6E6C66`。没有阴影，没有渐变，没有填充色。
- 版式（画布坐标）：框顶 y = 200，框高 640，框内边距上 56 左右 48。标题顶对齐框内上沿。占位块贴框内底：左右各 48，底 48，高 160。量尺线在框底下 32px，数字在量尺线下 20px，高 44px。
- 动的框是 `#rf-live`，水平居中在 x = 960（`xPercent: -50`），宽度由 `startWidth` 1440 连续变到 `endWidth` 390，画布 1:1 显示。

## MOTION
- 主动作只有一个：框宽 1440 到 390，0.5 – 2.1 秒，1.6 秒 `power2.inOut`，一条补间。标题是浏览器按当前框宽真实排版换行，字不裁切不溢出；`text-wrap: balance` 让每一行长度接近。
- 断点：宽度跨过 768 时标题字号 72px 到 48px，0.2 秒 `power2.inOut`。跨过时刻用代码按 `power2.inOut` 曲线反推：768 对应进度 (1440 - 768) / (1440 - 390) = 0.64，反推出补间的 0.5757，所以起点 = 0.5 + 1.6 × 0.5757 = 1.421 秒，到 1.621 秒结束。字号用 CSS 变量 `--fs` 做补间（不直接补间 `fontSize`，门禁会因为字号补间会按整数像素跳而报错；这里一共 6 帧，每帧 4px 左右，不影响观感）。
- 宽度数字：量尺上只有一个数字，是框宽的实时读数。CSS 变量 `--w` 和框宽放在同一条补间里（`startWidth` 到 `endWidth`，同样 1.6 秒 `power2.inOut`），用 CSS 计数器 `counter(w)` 配 `round(var(--w))` 显示成整数，所以任何一帧数字都等于框的实际宽度，跳帧渲染也成立。桌面框的数字由同一个机制驱动，值固定为 `startWidth`。起点和终点读变量，不再写死。
- 并排：2.6 – 3.5 秒，0.9 秒 `power2.inOut`，整个舞台缩到 0.8 倍（`#rf-stage`，原点 960,540），同时手机框（`#rf-live`）右移 780px（画布坐标，缩放前）到最终位置；桌面框 `#rf-desk` 在左边，3.1 – 3.7 秒用 `clip-path` 从左往右展开（0.6 秒 `power3.out`），展开的是真实排好的 1440 宽标题，不是图片淡化。从左往右、并且晚到 3.1 秒才开始，是为了等手机框先从桌面框的位置挪开，两个标题不会叠在一起；它的量尺 3.4 – 3.7 秒淡入。
- 并排后的画面（屏幕坐标）：桌面框 x 180 – 1332，手机框 x 1428 – 1740，间隔 96，上下边距一致。
- 停留：开头 0 – 0.5 秒桌面单行；手机宽停留 2.1 – 2.6 秒（0.5 秒）；并排停留 3.7 – 6.0 秒（2.3 秒，不少于 2 秒）。

## 逐拍节拍表
| 拍 | 起止秒 | 画面 | 镜头 | 转场 | 屏幕文案原文 |
| --- | --- | --- | --- | --- | --- |
| desktop | 0.00 – 0.50 | 1440 宽的框，标题 72px 单行，量尺写 1440 | 固定 | 无 | 把设计参考交给 AI，它就能照着做出来 |
| narrow | 0.50 – 2.10 | 框连续收窄到 390，标题真实重新换行；1.421 秒起字号降到 48px，量尺数字随框宽实时变化 | 固定 | 无 | 同上 |
| phone | 2.10 – 2.60 | 390 宽，标题三行，量尺 390 | 固定 | 无 | 同上 |
| compare | 2.60 – 3.70 | 舞台缩到 0.8，手机框移到右侧，桌面框从左往右展开 | 缩放 + 平移 | 无 | 同上（两个框各一份） |
| hold | 3.70 – 6.00 | 桌面和手机并排，各标宽度 1440 和 390 | 固定 | 无 | 同上 |

英文版：Give your AI the design reference and it builds the same thing，用 `headline` 变量传入，代码照常换行（72px 下 2 行，48px 下 3 到 5 行）。

## 换行检查
把标题放进同样的字体和样式，宽度从 1440 到 390 每 2px 一档扫了一遍（768 以上 72px，768 以下 72/60/48px 都扫）。中文和英文两句，没有出现一行只剩 1 到 2 个字符的情况。中文断点附近的换行：1330px 以上单行，之后「把设计参考交给 AI，」「它就能照着做出来」两行，约 760px 以下三行，390 宽时是「把设计参考交」「给 AI，它就」「能照着做出来」。

## 参数接线
全部参数是 `project/compositions/reflow.html` 根元素 `data-composition-variables` 里的变量，用户的 AI 在 `project/index.html` 里 `id="reflow"` 的挂载元素上加 `data-variable-values='{"headline":"Give your AI the design reference and it builds the same thing"}'`（JSON）覆盖：
- headline（把设计参考交给 AI，它就能照着做出来）：标题文案。
- accentColor（#2F5BFF）、ink（#1C1C1A）、muted（#6E6C66）、line（#BDB9AE）、bg（#E8E6E1）：颜色。`index.html` 里的底色 `#E8E6E1` 是兜底色，换 bg 时一起改。
- startWidth（1440）、endWidth（390）、breakpoint（768）：起始宽度、终点宽度、降字号的断点。量尺数字由 `--w` 驱动，自动跟随，不用手改。
- bigSize（72）、smallSize（48）：断点上下的标题字号。
- narrowAt（0.5）、narrowDuration（1.6）：收窄起点和时长，秒。
- sizeSwapDuration（0.2）：断点处字号过渡时长，秒。
- compareAt（2.6）：并排动作起点，秒；桌面框展开在它之后 0.5 秒，并排停留要保证不少于 2 秒。
并排缩放 0.8、间隔 120（画布坐标，缩放后 96）、动作时长 0.9 秒、展开时长 0.6 秒、框高 640 等版式数字是 `reflow.html` 里写死的数，不是变量。总时长 6 秒写在 `index.html` 和 `reflow.html` 的 `data-duration`。换成别的中文文案后必须重新跑门禁生成字体子集。

## 禁用项
两张预排好的图交叉淡化假装换行；手机机身、刘海、圆角边框；浏览器顶栏、圆点、地址栏；框内再画产品界面；收窄时文字被裁切或溢出；标签、步骤号、阶段名；弹跳、呼吸、漂浮；第二种强调色。

## 已知取舍
- impeccable 的奶油色底警告（cream-palette）：stone 底 #E8E6E1 是 BRIEF 指定，保留，用深色字和单一蓝色强调。
- `F8` 字数警告：画面上同一句话出现了两遍（桌面一份、手机一份），单句本身只有 18 个汉字加 2 个英文字，没有多余文字。
- 量尺数字是实时读数，不是断点档：用补间 `--w` 加 CSS 计数器实现，不靠时间线回调。
- 3.1 – 3.7 秒桌面框用 `clip-path` 从左往右展开，展开线会把标题从某个字中间切开，这是擦除效果本身；「文字不裁切不溢出」只约束收窄过程，那一段没有任何裁切。
- 框线色 `#BDB9AE` 比 BRIEF 的 `#D3D0C8` 深一档（评审指出原色对底只有约 1.3:1）；仍是细淡线，英文版换行没有在成片上跑过，英文行数只是扫描结果。
- 并排时手机框与桌面框都是真实排版后整体缩到 0.8 倍，字号 38px 和 58px 是缩放后的视觉大小。
- 收窄是补间 `width`，会让门禁提示布局属性动画：它是本条要展示的东西（真实换行），不能换成缩放。
- 桌面框那句话在 3.1 秒才出现，门禁会按它算出「最后一句停留 2.9 秒」的 line_unread 警告；同一句话从 0 秒起就在画面上，手机框一直在读，所以不修。
- 第一帧就是完整桌面框，不是空画面；`poster` 取 4.5 秒的并排画面。
- 成片验收：已从 `draft.mp4` 抽 1.0、1.45、3.25、5 秒四帧，背景铺满到四边，并排展开时桌面框没有压在手机框上。本条没有快速位移（最快的是 0.9 秒的整体缩放），不加运动模糊。
```
