# Two Cursors Edit One Line (两个光标一起改一句话)

Two named cursors come in from different sides: one drags a selection over a word in the headline, the other leaves a short comment, the first swaps the whole word and both leave. For collaboration and review stories.

- Ref: `video/motion-text-multiplayer-edit` (code video · motion · any · any · 6s at 30fps)
- Page: https://uifino.com/en/videos/motion-text-multiplayer-edit
- Markdown: https://uifino.com/md/videos/motion-text-multiplayer-edit.md
- Preview image: https://uifino.com/videos/motion-text-multiplayer-edit/poster.jpg

## Install

- ZIP: https://uifino.com/videos/motion-text-multiplayer-edit/source.zip

Two named cursors come in from different sides: one drags a selection over a word in the headline, the other leaves a short comment, the first swaps the whole word and both leave. For collaboration and review stories.

Rendered video: https://uifino.com/videos/motion-text-multiplayer-edit/preview.mp4

## Beats

- 0-1.3s The first cursor reaches the word start: The line is there from frame 0 and never moves; Lin's cursor curves in from outside the bottom left in 0.9 s, slows into the target, its name tag leaves with it and lands 2 frames later and it stops at 1.1 s Camera: static. On-screen text: "Make the point in the first three seconds".
- 1.3-1.65s Drag-select a word: After a 0.2 s stop it presses; a 30% accent selection is dragged from word start to word end in 0.35 s, cursor and selection edge in step Camera: static. On-screen text: "Make the point in the first three seconds".
- 1.65-3.1s The second cursor leaves a short comment: Mo's cursor curves in from outside the top right and stops above the word at 1.9 s, pauses 0.2 s, clicks, and from 2.15 s the bubble comes up in 0.25 s and stays Camera: static. On-screen text: "make it two".
- 3.1-3.8s Whole-word swap: The old word blurs out and the new one blurs in over 0.15 s, in one go and not letter by letter; the new word stays selected 0.4 s, then the selection fades in 0.15 s Camera: static. On-screen text: "Make the point in the first two seconds".
- 3.8-4.35s Both leave: Lin exits bottom left and Mo top right, accelerating, 0.5 s, power3.in; the bubble fades in 0.13 s Camera: static.
- 4.35-6s Let the viewer read: The finished line stays still for 1.65 s with no cursor on screen Camera: static. On-screen text: "Make the point in the first two seconds".

## Parameters

- `textBefore` Text before the word: default 开场
- `selectedWord` Selected word: default 三秒
- `newWord` Replacement word: default 两秒
- `textAfter` Text after the word: default 内讲清楚卖点
- `comment` Comment text: default 改成两秒
- `nameA` Name on the editing cursor: default Lin
- `nameB` Name on the commenting cursor: default Mo
- `accentColor` Accent color (first cursor and selection): default #D4412A
- `bg` Background: default #F6F5F2
- `ink` Text and second cursor color: default #121212
- `fontSize` Headline size: default 120px, range 64 to 160px
- `arriveDuration` Cursor travel time: default 0.9s, range 0.6 to 1.2s
- `settleDuration` Stop before acting: default 0.2s, range 0.2 to 0.4s
- `dragDuration` Drag duration: default 0.35s, range 0.3 to 0.5s
- `replaceDelay` Comment click to word swap: default 1s, range 1 to 1.4s
- `selHold` Selection hold after swap: default 0.4s, range 0.4 to 0.8s
- `exitDuration` Cursor exit duration: default 0.5s, range 0.4 to 0.7s

## Good for

- Launch films for collaboration, review or editing products
- Swapping one word in a headline of about 6 to 8 words
- A short beat that shows several people present at once

## Not for

- When the whole line is rewritten or typed out letter by letter
- Three or more cursors at once
- When the full product interface has to be shown

## Source files (plain text)

- https://uifino.com/videos/motion-text-multiplayer-edit/source/SPEC.md
- https://uifino.com/videos/motion-text-multiplayer-edit/source/PROMPT.md
- https://uifino.com/videos/motion-text-multiplayer-edit/source/NOTICE.md
- https://uifino.com/videos/motion-text-multiplayer-edit/source/project/assets/fonts/OFL.txt
- https://uifino.com/videos/motion-text-multiplayer-edit/source/project/compositions/edit.html
- https://uifino.com/videos/motion-text-multiplayer-edit/source/project/hyperframes.json
- https://uifino.com/videos/motion-text-multiplayer-edit/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.4 KB |
| SPEC.md | doc | 7.9 KB |

### PROMPT.md

```md
# PROMPT：motion-text-multiplayer-edit

## 照抄复刻
用 `/hyperframes` 做一条 1920×1080、30 fps、6 秒的动效：浅色底上一句话，两个带名字的光标一起改它。

1. 画面：底 `#F6F5F2`，字 `#121212`，强调色 `#D4412A`。整句「开场三秒内讲清楚卖点」单行居中，120px、字重 600、字距 -0.02em，行盒 top 468px、高 144px，从第 0 帧起就在，全程不动。字体本地 `@font-face`：西文 Instrument Sans，中文 Noto Sans SC。字号只有三档：标题 120、气泡 36、名字标签 28。
2. 光标：矢量箭头 42×56px，边是 2px 底色描边；Lin 填 `#D4412A`，Mo 填 `#121212`。名字标签挂在光标尖右下 (30, 46)，高 44px，圆角 8px，字 28px，字色用底色；标签与光标同起点、同缓动，时长长 2 帧（2/30 秒），所以紧跟光标、落点晚 2 帧到；离场时标签与光标同步；名字标签元素加 `data-motion-blur="off"`。
3. 走位必须像人手：x 和 y 用两条不同的缓动，路径是弧线。Lin 从画外左下进场，x `power3.out`、y `power2.inOut`，0.9 秒，到点前自然减速；Mo 从画外右上进场，x `power2.inOut`、y `power3.out`，0.9 秒。到点后停 0.2 秒再动作。
4. 时间：Lin 0.2 秒起走，1.1 秒到「三」的左缘，1.3 秒按下（光标缩到 0.86 再弹回，不要光圈），选区 `#D4412A` 30% 不透明度，从词头拖到词尾，0.35 秒 `power1.inOut`，光标和选区边缘同步。Mo 1.0 秒起走，停在词的右上方，1.9 秒到，2.1 秒点击，2.15 秒起留言气泡 0.25 秒浮现（透明度、缩放 0.94 到 1、6px 模糊到 0，`power3.out`），一直停到 3.98 秒。
5. 气泡：白底，2px `#E2DFD8` 边，圆角 16px，高 76px，字「改成两秒」36px，阴影 `0 8px 24px rgba(18,18,18,0.10)`；左缘在 Mo 光标尖右 14px，下缘在尖上 14px。不要表情、点赞、回复按钮。
6. 改词：3.1 秒整词替换，「三秒」0.15 秒淡出加 6px 模糊，「两秒」同时淡入，不逐字；新词保持选中 0.4 秒，3.65 秒起选区 0.15 秒淡掉。
7. 离场：3.8 秒 Lin 向左下、3.85 秒 Mo 向右上，加速出画，0.5 秒 `power3.in`；气泡 0.13 秒淡出。4.35 秒后整句静止到 6 秒，画面里没有光标。
8. 根元素加 `data-motion-blur="on"`。
9. 禁止：产品界面外框、工具栏、头像列表，光标直线匀速或瞬移，气泡带表情和点赞，点击光圈。

需要替换的地方（在 `index.html` 里 `id="edit"` 的挂载元素上写 `data-variable-values` 传入）：
- 整句拆成 `textBefore`、`selectedWord`、`newWord`、`textAfter`（英文版要带空格：`Make the point in the first ` / `three` / `two` / ` seconds`），留言 `comment`，两个名字 `nameA`、`nameB`。
- 颜色 `accentColor`、`bg`、`ink`；字号上限 `fontSize`（整句超过 1560px 宽时先降到 64px，仍超再按比例缩）。
- 节奏 `arriveDuration`、`settleDuration`、`dragDuration`、`replaceDelay`、`selHold`、`exitDuration`。
- 换了文字要重新生成字体子集，否则缺字。不要加产品界面和其他文字。

## 只学手法
光标要像人手：走弧线（x、y 用不同缓动）、到点前 0.3 秒减速、停 0.2 秒再动作；名字标签与光标同时出发、晚 2 帧到点；选区是该光标颜色的 30% 透明度，0.35 秒拖完；改词是整词一次替换，新词保持选中 0.4 秒再取消；两个光标离场后整句静止至少 1 秒。
```

### SPEC.md

```md
# SPEC：motion-text-multiplayer-edit

## LOOK
- 色值：底 `#F6F5F2`，字和 Mo 的光标 `#121212`，线和气泡边 `#E2DFD8`，气泡底 `#FFFFFF`；强调色 `#D4412A` 只给 Lin 的光标、名字标签和选区（面积远小于 10%）。BRIEF 里的次要字 `#6B6966` 画面里没有次要文字，没用。中性色共 4 个。
- 字体：西文 Instrument Sans（`assets/fonts/instrument-sans.woff2`），中文 Noto Sans SC（`assets/fonts/noto-sans-sc.woff2`），本地 `@font-face`，门禁按用到的字生成子集。
- 字号三档：标题 120px 字重 600、字距 -0.02em、行高 144px；留言气泡 36px 字重 500；名字标签 28px 字重 600。英文句子在 120px 下超过 1560px 宽，自动降到 64px 这一档（见参数接线 fontSize），不新增字号。
- 圆角两档：8px（名字标签）、16px（留言气泡）。选区 0 圆角（和真实编辑器的选区一样），光标是矢量箭头。
- 阴影一档：气泡 `0 8px 24px rgba(18,18,18,0.10)`，光源在上。光标不带阴影。
- 版式：整句单行水平居中，行盒 `top 468px`、高 144px，字落在 y=540 附近，从第 0 帧起就在，全程不平移（只在改词时因新旧词宽度不同做一次 0.15 秒的居中修正，中文版两个词宽度相同，修正量为 0）。
- 光标：矢量箭头，尺寸 42×56px，箭头尖在元素坐标原点（用 `left -6px / top -3px` 偏出），边是 2px 底色描边，填色 Lin 是 `#D4412A`、Mo 是 `#121212`。名字标签挂在光标尖右下 (30px, 46px)，高 44px，左右内边距 14px，字色是底色。
- 选区：`#D4412A` 在 30% 不透明度，高 = 字号×1.2（120px 时 144px），竖向以 y=540 居中，宽 = 被选词宽，左缘贴词头。
- 留言气泡：高 76px，左右内边距 24px，2px `#E2DFD8` 边，白底。位置：左缘 = Mo 光标尖 x + 14px，下缘 = Mo 光标尖 y − 14px。

## MOTION
- 光标走位：x 和 y 用两条不同缓动，路径自然弯成弧线，不是直线。Lin 进场 x `power3.out`、y `power2.inOut`，Mo 进场 x `power2.inOut`、y `power3.out`，时长 0.9 秒，缓动尾巴使到点前约 0.3 秒明显减速。离场 x、y 都用 `power3.in`，0.5 秒（入场的 55%）。
- 名字标签：进场和拖选时与光标同一时刻出发、同样的缓动，时长比光标长 2 帧（2/30 秒），所以快速段紧跟光标，落点比光标晚 2 帧到；离场时标签与光标完全同步（同起点、同时长）。名字标签元素带 `data-motion-blur="off"`，不被运动模糊拉成色块，名字全程读得清。
- 停顿：到点后停 0.2 秒（`settleDuration`），再动作。
- 按下：光标箭头缩到 0.86 倍再弹回，0.07 秒压下加 0.14 秒回弹（`power2.out` / `power3.out`），没有光圈。
- 拖选：Lin 按下后 0.35 秒内，选区 `scaleX` 0 到 1（原点在左缘）、光标 x 从词头到词尾，同缓动 `power1.inOut`，两者同步；标签同起点、时长长 2 帧，终点晚 2 帧。
- 留言：气泡 0.25 秒浮现，`opacity` 0 到 1、`scale` 0.94 到 1、模糊 6px 到 0，`power3.out`，原点左下；Mo 点击后 0.05 秒出现。
- 改词：整词替换，旧词 0.15 秒 `power2.in` 淡出加 6px 模糊，新词同时 0.15 秒 `power3.out` 淡入加模糊消去，不逐字。新词落定后保持选中 0.4 秒，选区再 0.15 秒 `power2.in` 淡掉。
- 离场：选区淡掉结束后 Lin 先走；Mo 晚 0.05 秒走，气泡同时 0.13 秒淡出加模糊。
- 运动模糊：`index.html` 根上 `data-motion-blur="on"`，快速位移（入场末段、离场）带拖影。
- 时间表默认值（秒）：Lin 起 0.2，到词头 1.1，按下 1.3，拖完 1.65；Mo 起 1.0，到点 1.9，点击 2.1，气泡 2.15 到 2.4；换词 3.1 到 3.25；选区淡掉 3.65 到 3.8；Lin 离场 3.8 到 4.3，Mo 离场 3.85 到 4.35（标签与各自光标同时到）；4.35 之后整句静止到 6.0，共约 1.65 秒。气泡停留 2.15 到 3.98，约 1.83 秒。

## 逐拍节拍表
| 拍 | 起止秒 | 画面 | 镜头 | 转场 | 屏幕文案原文 |
| --- | --- | --- | --- | --- | --- |
| arrive | 0 - 1.3 | 整句已在；Lin 光标走弧线进来，到点前减速，停住 | 固定 | 无 | 开场三秒内讲清楚卖点 |
| select | 1.3 - 1.65 | Lin 按下，选区拖过「三秒」 | 固定 | 无 | 开场三秒内讲清楚卖点 |
| comment | 1.65 - 3.1 | Mo 光标走弧线到词的右上方，停 0.2 秒点击，气泡浮现 | 固定 | 无 | 改成两秒 |
| replace | 3.1 - 3.8 | 「三秒」换成「两秒」，新词保持选中 0.4 秒后取消 | 固定 | 无 | 开场两秒内讲清楚卖点 |
| leave | 3.8 - 4.35 | 两个光标加速出画，气泡淡出 | 固定 | 无 | 无新文案 |
| rest | 4.35 - 6 | 整句静止，没有光标 | 固定 | 无 | 开场两秒内讲清楚卖点 |

英文版：`Make the point in the first three seconds`，选中 `three`，留言 `make it two`，换成 `two`。变量写法：textBefore `Make the point in the first `（末尾带空格）、selectedWord `three`、newWord `two`、textAfter ` seconds`（开头带空格）、comment `make it two`。已临时改成英文跑过门禁截帧（测完改回）。

## 参数接线
全部参数都是 `project/compositions/edit.html` 根元素 `data-composition-variables` 里的变量，用户的 AI 在 `project/index.html` 里 `id="edit"` 的挂载元素上写 `data-variable-values='{...}'`（JSON）覆盖：
- textBefore、selectedWord、newWord、textAfter：整句拆成三段加一个被换的词，前后段的空格要自己带上。
- comment：气泡文字；nameA、nameB：两个名字标签。
- accentColor（#D4412A）、bg（#F6F5F2）、ink（#121212）。气泡底 `#FFFFFF` 和气泡边 `#E2DFD8` 写在 `edit.html` 的样式里，换底色时同改。`index.html` 里 `#F6F5F2` 是兜底底色，`bg` 变量和它一起改。
- fontSize（120）：标题字号；整句在这个字号下超过 1560px 宽，就先降到 64px；64px 下仍超过 1560px，再按 `floor(64 × 1560 ÷ 64px 下的宽度)` 缩。宽度是字体加载完后用隐藏元素量出来的，中文版 120px 下约 1320px，英文版 120px 下约 2160px，降到 64px 后约 1150px。
- arriveDuration（0.9）：两个光标的进场时长。
- settleDuration（0.2）：到点后停顿；dragDuration（0.35）：拖选时长。
- replaceDelay（1）：从 Mo 点击到换词的间隔，最小 1，保证气泡在换词时已出现 0.75 秒以上、离场时已停留超过 1.2 秒。
- selHold（0.4）：换词后保持选中的时间。
- exitDuration（0.5）：离场时长。
- 总时长 6 秒写在 `index.html` 和 `edit.html` 的 `data-duration`；改了 replaceDelay、selHold 等会推迟离场，要保证 4.35 秒之后的静止时间仍有至少 1 秒。
- 写死在代码里的常量（改 `edit.html` 的 `build()`）：Lin 起点 0.2 秒、Mo 起点 1.0 秒（`aStart`、`bStart`）；光标起点终点（`aX0/aY0`、`bX0/bY0` 为画外，`aX1/aY1`、`bX1/bY1` 为离场终点）；Mo 停靠点 `bX = 词尾 + 24`、`bY = 372`；Lin 落点 `lineY = 548`；标签偏移 `TX 30 / TY 46`；标签落点延迟 `LAG = 2/30`（进场和拖选时加在标签时长上）；换词时长 0.15。

## 禁用项
产品界面外框、工具栏、头像列表；光标直线匀速或瞬移；气泡带表情、点赞、回复按钮；点击光圈；呼吸漂浮循环；逐字替换；光标一直乱动；标题在光标走后还在动。

## 已知取舍
- `first_frame_empty` 不会出现：整句从第 0 帧就在。封面取 5 秒（整句完成、光标已离开）。
- 光标尖盖在字上：Lin 落点在选区左缘和右缘的字线中下部，是真实编辑器里光标的样子，不是遗漏。
- Lin 在 1.65 到 3.8 秒之间不动，是在等 Mo 的留言，视觉上是一个静止光标。
- 名字标签关掉了运动模糊（`data-motion-blur="off"`），光标箭头本身在成片里没有明显拖影，进场和离场的速度感靠缓动。
- 换词的 0.15 秒里新旧词会叠在一起，是 BRIEF 要求的同时淡入淡出。
```
