feat(tasks): 画布动效改为布局坐标补间 + 错峰入场,FLIP 库只留流式布局

维护者第二轮反馈「还是突然直接出现」。上一版把 FLIP 库从画布摘掉后只留了
150ms 淡入 —— 太弱,看不出是「入场」。而且这个面本身需要的是**位置**动效,
不是入场动效,于是补上画布自己的补间:

- tasks-layout-tween.ts:rAF 逐帧插值每张卡在**画布坐标**里的 x / y / 高度。
  为什么必须是坐标而不是 transform:卡片层带 fit 的 scale(k),left/top 是画布
  单位,缩放对它和对终点位置一样生效;量 rect 再播未缩放 translate 的 FLIP 在
  这里恒差 k 倍,auto-animate 还会把离场卡片钉上无法表达的绝对 left/top。
  fromRef 跟着「已绘制」状态走 —— 中途再次变布局时接着当前位置走,不弹回。
- 连线路径与相位框改为读补间后的盒子(它们本就是盒子的纯函数),于是线跟着
  卡片走,不再在卡片还在飞的时候先瞬移到终点。
- 入场改为 300ms 上浮 + 0.88→1 缩放 + 淡入(轻微过冲),按节点页序错峰 26ms,
  fill-mode: backwards 让等待中的卡片先隐形;reduced-motion 下补间与入场都关。
  修掉首版的一帧空档:新入场的节点在引入它的那一帧就带目标盒子渲染。
- 读者一碰折叠即接管视图(聚合卡 / 卡片 chevron / 控制条开关 → markTouched),
  此后画布不再随布局自动重框;切会话重置并重新适配(顺带修掉换会话不适配的旧账)。
- FLIP 库保留在树视图与任务抽屉(那里离场是原地淡出 + 兄弟滑位的流式语义)。

守护:tests/tasks-layout-tween.spec.tsx(插值 / 缓动 / 中途位置 / 画布尺寸不中途
变化 / 入口盒子不缺席)与 tests/tasks-motion.spec.ts 扩到 5 条(画布不得 import
FLIP 库、必须在画布坐标补间、入场必须错峰、折叠必须接管视图)。

全套 2248 passed / 17 skipped(193 文件)、tsc 与 eslint 0 错误、构建通过;
新构建已装进 sidebar-test,:3080 挂载正常(0 pageerror)。
This commit is contained in:
Menghuan1918 committed 2026-10-11 23:29:51 +08:00
1 parent 34671dcb34
commit e6f9eda60f
7 files changed
+428 -24

No files matched your search

+12 -7
View File
@@ -142,11 +142,15 @@
activity. The layout in tasks-graph-layout.ts reserves those rows, so the
box handed to a card is exactly its height. */
.node {
/* Cards ARRIVE with a short entrance and leave instantly: the leaving side
is what a FLIP library would animate, and it is exactly what a scaled
canvas layer cannot express (see TasksGraph). Mount-only, so the page's
poll never re-plays it, and the edges they hang from stay honest. */
animation: dsh-card-in 150ms cubic-bezier(0.2, 0.8, 0.3, 1);
/* Cards ARRIVE with a real entrance — a rise, a scale-up and a fade, with a
slight overshoot so the arrival reads as motion rather than a repaint. The
per-card `animation-delay` the graph sets inline staggers a group that
reveals several cards at once; `backwards` keeps a staggered card invisible
during its wait instead of popping and then animating. Mount-only, so the
page's poll never re-plays it. Position changes are NOT animated here: the
graph tweens the layout coordinates instead (tasks-layout-tween.ts), which
is the only space the fit's scale cannot distort. */
animation: dsh-card-in 300ms cubic-bezier(0.2, 0.9, 0.25, 1.06) backwards;
position: absolute;
box-sizing: border-box;
display: flex;
@@ -819,8 +823,9 @@
}
@keyframes dsh-card-in {
from { opacity: 0; transform: translateY(2px); }
to { opacity: 1; transform: none; }
0% { opacity: 0; transform: translateY(10px) scale(0.88); }
60% { opacity: 1; }
100% { opacity: 1; transform: none; }
}
@keyframes dsh-pop-in {