# Hard-Edge Wipe (硬边擦除)

A hard accent-colored edge sweeps right to left and reveals the next scene behind it, while both scenes stay still; for a clean change between two lines.

- Ref: `video/motion-transition-hard-wipe` (code video · motion · any · any · 4.5s at 30fps)
- Page: https://uifino.com/en/videos/motion-transition-hard-wipe
- Markdown: https://uifino.com/md/videos/motion-transition-hard-wipe.md
- Preview image: https://uifino.com/videos/motion-transition-hard-wipe/poster.jpg

## Install

- ZIP: https://uifino.com/videos/motion-transition-hard-wipe/source.zip

A hard accent-colored edge sweeps right to left and reveals the next scene behind it, while both scenes stay still; for a clean change between two lines.

Rendered video: https://uifino.com/videos/motion-transition-hard-wipe/preview.mp4

## Beats

- 0-1.5s Let the viewer read the first line: Dark text on a light ground, fully still, the edge waits off-canvas right Camera: static. On-screen text: "Stitch every frame by hand".
- 1.5-2.1s Switch to the second line cleanly: A 12 px accent edge sweeps from x=1920 to x=-12 with power3.inOut, dark ground revealed to its right, both scenes still Camera: static. Transition: hard-wipe.
- 2.1-4.5s Let the viewer read the second line: Light text on a dark ground, full frame, fully still Camera: static. On-screen text: "Build from a good reference".

## Parameters

- `edgeWidth` Edge width: default 12px, range 4 to 48px
- `wipeStart` Wipe start: default 1.5s, range 0 to 2s
- `wipeDuration` Wipe duration: default 0.6s, range 0.3 to 1.5s
- `wipeEase` Wipe ease: default power3.inOut
- `bg` First scene ground (second scene text): default #E8E6E1
- `ink` First scene text (second scene ground): default #1C1C1A
- `accentColor` Edge color: default #2F5BFF
- `copyA` First line: default 手动拼每一帧
- `copyB` Second line: default 照着好参考做

## Good for

- Two lines that contrast (old way versus new way)
- A clean, unfussy scene change
- Two scenes with the same layout, only copy and ground color change
- Defaults to 4.5 s: first line holds 1.5 s, wipe 0.6 s, second line holds 2.4 s; for slower reading raise the duration and wipeStart together

## Not for

- Diagonal, curved or glowing wipes
- Scenes that must move during the change
- A film whose only content is this one change

## Source files (plain text)

- https://uifino.com/videos/motion-transition-hard-wipe/source/SPEC.md
- https://uifino.com/videos/motion-transition-hard-wipe/source/PROMPT.md
- https://uifino.com/videos/motion-transition-hard-wipe/source/NOTICE.md
- https://uifino.com/videos/motion-transition-hard-wipe/source/project/assets/fonts/OFL.txt
- https://uifino.com/videos/motion-transition-hard-wipe/source/project/compositions/wipe.html
- https://uifino.com/videos/motion-transition-hard-wipe/source/project/hyperframes.json
- https://uifino.com/videos/motion-transition-hard-wipe/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 | 2.5 KB |
| SPEC.md | doc | 5.6 KB |

### PROMPT.md

```md
# PROMPT：motion-transition-hard-wipe

## 照抄复刻
用 `/hyperframes` 做一个 1920×1080、30 fps、4.5 秒的硬边擦除转场。一个场景文件，不开运动模糊，不用任何图片或截图。

画面：
1. 第一幕整屏底 `#E8E6E1`，文案「手动拼每一帧」，字色 `#1C1C1A`，思源黑体（Noto Sans SC）加 Hanken Grotesk，120px、字重 700、字距 -0.02em、行高 156px，整屏 flex 容器、左右内边距 192px、垂直居中、左对齐。
2. 第二幕叠在第一幕上面，版式、字号、位置完全相同，只换文案「照着好参考做」、底色 `#1C1C1A` 和字色 `#E8E6E1`。第二幕用 `clip-path: inset(0 0 0 Npx)` 裁剪，起始 N = 1920 + 边宽 = 1932（整个被遮住）。
3. 一条边：宽 12px、高 1080px、强调色 `#2F5BFF`，直角实心，没有渐变、羽化、发光、拖影，用 x 平移定位。

动作：
- 0.0–1.5 秒：完全静止，边在画外右侧（x = 1920）。
- 1.5–2.1 秒：用一个数值 tween，把 x 从 1920 走到 -12，0.6 秒，`power3.inOut`。每次更新把 x 取整，边平移到 x，第二幕的裁剪左边界设成 `x + 12`，所以边永远贴在第二幕左边缘。
- x 到 -11（边只剩 1px）时，把边和第一幕都设为 `visibility: hidden`，第二幕裁剪归零。
- 2.1–4.5 秒：完全静止，第二幕整屏。
- 两幕在擦除过程中不移动、不缩放、不淡入淡出。

需要替换的地方：
- 文案：变量 `copyA`（中文「手动拼每一帧」，英文 `Stitch every frame by hand`）、`copyB`（中文「照着好参考做」，英文 `Build from a good reference`）。英文较长时会自动折成两行，仍然垂直居中。
- 颜色：`bg`（第一幕底色和第二幕字色）、`ink`（第一幕字色和第二幕底色）、`accentColor`（边的颜色）。
- 边宽 `edgeWidth`（默认 12px）；时间和缓动 `wipeStart`（1.5）、`wipeDuration`（0.6）、`wipeEase`（`power3.inOut`）。
- 变量声明在场景根元素的 `data-composition-variables` 上，换值时在宿主上写 `data-variable-values`。
- 不是变量的：画布宽 1920（脚本里的 `W`）、整片时长 4.5 秒（`index.html` 的 `data-duration`）。
- 字体用本地 `@font-face` 指向 `assets/fonts/`，不要联网取字体。

## 只学手法
第二幕一直整屏躺在第一幕上面，用一个跟着边走的裁剪窗口一点点露出来：12px 强调色硬边在 0.6 秒内用 `power3.inOut` 从 x = 1920 扫到 x = -12，两幕版式相同、各自静止，只有这条边在动，没有发光和拖影。
```

### SPEC.md

```md
# SPEC：motion-transition-hard-wipe

## 一句话
一条强调色竖边从画面右边缘扫到左边缘，边走过的地方露出第二幕。两幕各自完全静止，只有这条边在动。

## 怎么做到「干脆」
- 第二幕从第 0 帧起就铺满整屏躺在第一幕上面，只是被裁剪遮住。裁剪区域的左边界跟着竖边走，所以每一帧两幕的文字位置都不动，动的只有边界。
- 边是一整条实心色块，直角、无羽化、无发光、无拖影，不开运动模糊。
- 边的位置每帧取整到整数像素，边界不会落在半个像素上变虚。
- 不开运动模糊，所以中段每帧位移 260 - 370px，画面是跳变式的硬扫，这是任务书要求的代价，有意为之。

## LOOK
- 色值（中性色 4 个，强调色 1 个，来自 stone 配色）：
  - 底 `#E8E6E1`（第一幕底色，第二幕字色）
  - 字 `#1C1C1A`（第一幕字色，第二幕底色）
  - 次要字 `#6E6C66`、线 `#D3D0C8`：配色里有，本条不上屏，没有使用
  - 强调色 `#2F5BFF`：只用在那条边上，面积 12×1080，约占画面 0.6%
- 字体：中文 Noto Sans SC（`assets/fonts/noto-sans-sc.woff2`），西文 Hanken Grotesk（`assets/fonts/hanken-grotesk.woff2`），font-family 顺序 `"Hanken Grotesk", "Noto Sans SC"`。
- 字号只有一档：120px，字重 700，字距 -0.02em，行高 156px。
- 圆角：无（全部 0）。
- 阴影：无。
- 光源、渐变、辉光：都没有。

### 画面几何（1920×1080）
- 两幕版式完全相同：整屏 flex 容器，左右内边距 192px，文字垂直居中，左对齐。中文一行（6 个字宽 720px）；英文会超过 1536px 宽度时自动折成两行，仍然垂直居中。
- 第一幕：底 `#E8E6E1`，字 `#1C1C1A`，文案「手动拼每一帧」。
- 第二幕：底 `#1C1C1A`，字 `#E8E6E1`，文案「照着好参考做」，叠在第一幕上面。
- 边：宽 12px，高 1080px，左上角 (0, 0)，用 x 平移定位，直角实心。

## MOTION
- 只有一个动作：边从右到左扫过全屏。
- 起止：边的左沿 x 从 1920（脚本初始化时第二幕裁剪量为 1920 + 边宽 = 1932）走到 -12（整条边在画外左侧），行程 1932px。
- 时长 0.6 秒，缓动 `power3.inOut`，开始于 1.5 秒。
- 第二幕可见区域 = 边的右沿（x + 12）到 1920。用 `clip-path: inset(0 0 0 (x+12)px)` 实现，边紧贴着第二幕，露出的永远是边右侧。
- 边的左沿 x 到 -11（只剩 1px 贴在左缘）时，边和第一幕一起设为 `visibility: hidden`，第二幕裁剪归零整屏接管，不留一帧的蓝色细线。
- 没有运动模糊、没有淡入淡出、没有位移、没有缩放；扫过之前和之后画面完全静止。
- 参考时间点（1.5 秒起，0.6 秒 power3.inOut，边的左沿 x）：1.65 秒约 1860；1.8 秒约 954（正中偏左）；1.95 秒约 48；2.1 秒起已到画外。
- 读秒：第一句完整可读 0 - 1.8 秒（边扫到字块右端 x=912），约 1.8 秒；第二句从边扫过字块左端（约 1.95 秒）起完整可读到 4.5 秒，约 2.5 秒。

## 逐拍节拍表
| 拍 | 起止秒 | 画面 | 镜头 | 转场 | 屏幕文案原文 |
| --- | --- | --- | --- | --- | --- |
| hold-a | 0.0 - 1.5 | 浅底深字，边在画外右侧 | 固定 | 无 | 手动拼每一帧 |
| wipe | 1.5 - 2.1 | 边从右到左扫过，右边露出深底浅字 | 固定 | 硬边擦除，0.6 秒，power3.inOut | 手动拼每一帧 → 照着好参考做 |
| hold-b | 2.1 - 4.5 | 深底浅字，完全静止 | 固定 | 无 | 照着好参考做 |

英文版：「Stitch every frame by hand」→「Build from a good reference」，在 `index.html` 宿主上写 `data-variable-values` 切换，英文会折成两行，位置依然垂直居中。已用英文跑过一次门禁并看过截图，布局正常。

## 参数接线
全部是 `project/compositions/wipe.html` 根元素 `data-composition-variables` 里的变量，换值的办法是在 `index.html` 宿主 `#wipe` 上写 `data-variable-values`：
- `copyA`（第一幕文案）、`copyB`（第二幕文案）
- `bg`（第一幕底色和第二幕字色，默认 `#E8E6E1`）、`ink`（第一幕字色和第二幕底色，默认 `#1C1C1A`）、`accentColor`（边的颜色，默认 `#2F5BFF`）
- `edgeWidth`（边宽，默认 12px，行程随之变成 1920 + 边宽）
- `wipeStart`（扫过开始时间，默认 1.5 秒）、`wipeDuration`（扫过时长，默认 0.6 秒）、`wipeEase`（缓动，默认 `power3.inOut`）
- 不是变量的：画布宽 1920（`wipe.html` 脚本里的 `W`），换画幅时要改；文字 120px 和内边距 192px 写在 `wipe.html` 的样式里。
- `index.html` 根和宿主的 `data-duration`（4.5 秒）要和 `entry.json` 的 `canvas.duration` 一起改，变量改不了。

## 禁用项
发光或模糊拖影的边、两幕在擦除时各自移动、斜向或弧形擦除、羽化渐变边、运动模糊、淡入淡出代替擦除、画面上多余的说明文字。

## 已知取舍
- 门禁警告 `cream-palette`：底色 `#E8E6E1` 是任务书指定的 stone 配色，保留；深色第二幕和蓝色边让整体不是单一的暖白模板。
- 缓动是 `power3.inOut`，边在两头慢、中间快，边扫过文字区域时最快；这是任务书的要求。
- 扫过结束后第一幕被隐藏，是为了不让它在第二幕下面被检查成「被遮住的文字」；第一幕的文字在擦除中被遮住是设计，已在文字上加了 `data-layout-allow-occlusion` 和 `data-layout-allow-overlap`。
- 边有一部分起止时在画外，加了 `data-layout-allow-overflow`。
- `first_frame_empty` 不适用：第 0 帧就是完整的第一幕。`poster` 取 4 秒，画面是完整可读的第二句。
```
