deconstruct

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Deconstruct

Deconstruct(拆解)

This skill takes an animation or interaction apart. It names every state and event, splits each transition into one track per property and puts both on a page the user can scrub and edit.
这个 skill 会将动画或交互拆解开来。它会为每个状态和事件命名,将每次转换拆分为每个属性各一条轨道,并将两者放在用户可拖动定位和编辑的页面上。

Every frame accounted for

每一帧都有据可查

Nothing is described by feel. Every state has a name, every transition has an event and every animated property has its from, to, delay, duration and easing. A value that could not be read is marked
Not verified
, never estimated.
Reading computed values and the side-by-side proof belong to
match
. Forcing component states open belongs to
lab
. Opening the result runs in
verify
. Whether the motion's values are right belongs to
motion
.
所有内容都基于实际读取,而非凭感觉描述。每个状态都有名称,每次转换都有对应事件,每个动画属性都有 from、to、delay、duration 和 easing。无法读取的值会标记为
Not verified
,绝不进行估算。
读取计算值和并排对照验证属于
match
。强制打开组件状态属于
lab
。打开结果时会在
verify
中运行。动效数值是否正确属于
motion
。

1. Capture the real motion

1. 捕获真实动效

Open the source: the code, the live page or a recording. Read keyframes, transitions and spring configs, or step through frames at reduced playback speed. A breakdown from one viewing is
deconstruct-capture-the-source
.
打开源:代码、实时页面或录屏。读取 keyframes、transitions 和 spring 配置,或以降低的播放速度逐帧查看。仅观看一次得出的拆解属于
deconstruct-capture-the-source
。

2. Name the states and events

2. 命名状态和事件

List the states the element can rest in and the events that move it between them, such as press, release, resolve and timeout. Write them as a table of state, entered on and left on. A sentence like "it shrinks, then spins" is
deconstruct-name-the-states
.
列出元素可以停留的状态,以及使元素在状态之间切换的事件,例如 press、release、resolve 和 timeout。将它们写成包含 state、entered on 和 left on 的表格。"它先缩小,然后旋转"这样的句子属于
deconstruct-name-the-states
。

3. Split each transition into tracks

3. 将每次转换拆分为轨道

Give every animated property its own track: scale, opacity, blur, width, colour, icon and label. Each track lists from, to, delay, duration and easing. "About 300ms" is
deconstruct-every-property
.
Keep the curve as written. A spring stays a spring with its stiffness, damping and mass, or its bounce and duration. A spring flattened into a guessed bezier is
deconstruct-keep-the-curve
.
为每个动画属性设置独立轨道:scale、opacity、blur、width、colour、icon 和 label。每条轨道都会列出 from、to、delay、duration 和 easing。"大约 300ms"属于
deconstruct-every-property
。
保持曲线原样。spring 必须保持为 spring,并记录其 stiffness、damping 和 mass,或 bounce 和 duration。将 spring 压平成猜测的 bezier 属于
deconstruct-keep-the-curve
。

4. Drive it from one clock

4. 使用同一个时钟驱动

Render the element as a pure function of one time value. Scrubbing, pausing and looping then show the same frame for the same time. A viewer that replays CSS and cannot stop mid-transition is
deconstruct-one-clock
.
将元素渲染为单个时间值的纯函数。这样,拖动定位、暂停和循环播放时,相同时间点都会显示相同帧。只能重放 CSS 且无法在转换中途停止的 viewer 属于
deconstruct-one-clock
。

5. Build the viewer

5. 构建查看器

Copy viewer.html beside the rebuild as a development-only page, write
timeline.js
next to it in the shape its header comment shows and open it. It shows the element, the state machine and one lane per track with its live value.
The viewer ships with the skill, so write data only. A page with its own markup or styles is
deconstruct-shipped-viewer
. It highlights the active state, and clicking a state seeks to it. Its scrubber, play, pause and 0.25× stay in. A timeline with no scrubber is
deconstruct-scrub-the-timeline
.
The inspector writes from, to, delay, duration and easing, and the preview follows. Drag a segment to change its delay. Drag its right edge to change its duration. Drag an event mark to move that event on every track. A timing changed in the reply instead of on the segment is
deconstruct-edit-the-segment
.
Pinch or hold Cmd and scroll to zoom the timeline. Scroll sideways to pan, and Fit returns to the full duration. Drag a slider and the preview follows. Drag the bezier handles or pick a keyword from the easing menu.
Segments, layers and events snap to each other and to the playhead. Hold Alt to drag without snapping. Shift-click segments to move them together.
A spring's length follows from its curve. Change stiffness, damping and mass to change it, or drag the edge of a bounce and duration spring.
Opening a track draws its value over time under the lane, so an overshoot shows. Tracks on one element group under its selector, and dragging the group moves them all.
Cmd+Z undoes any edit. An edited field shows a dot and Revert. Original plays the timeline as it was loaded, so the edit is judged against the source.
将 viewer.html 复制到重建项目旁边,作为仅用于开发的页面;按照 timeline.js 头部注释所示的结构在旁边编写该文件,然后打开。它会显示元素、状态机,以及每条轨道各自的泳道和实时值。
viewer 随 skill 一同提供,因此只需编写数据。自行包含 markup 或 styles 的页面属于
deconstruct-shipped-viewer
。它会高亮当前状态,点击某个状态即可定位到该状态。必须保留 scrubber、play、pause 和 0.25×。没有 scrubber 的 timeline 属于
deconstruct-scrub-the-timeline
。
inspector 会写入 from、to、delay、duration 和 easing,预览随之更新。拖动 segment 可更改其 delay,拖动其右边缘可更改 duration,拖动 event 标记可在每条轨道上移动该 event。只在回复中修改 timing 而未在 segment 上修改,属于
deconstruct-edit-the-segment
。
双指捏合,或按住 Cmd 并滚动,即可缩放 timeline。横向滚动可平移视图,Fit 会回到完整时长。拖动 slider 时预览会同步变化。拖动 bezier handles,或从 easing 菜单中选择 keyword。
片段、图层和事件会相互吸附,并与播放头对齐。按住 Alt 拖动可取消吸附。Shift-click 片段可将其一起移动。
spring 的长度由其曲线决定。更改 stiffness、damping 和 mass 即可改变长度,也可以拖动 bounce-and-duration spring 的边缘。
展开一条轨道后,会在泳道下方绘制其随时间变化的数值,从而显示 overshoot。同一元素上的轨道会按 selector 分组,拖动该组会移动其中所有轨道。
Cmd+Z 可撤销任何编辑。编辑过的字段会显示圆点和 Revert。Original 会按加载时的样子播放 timeline,以便对照源文件评估这次编辑。

6. Compare at slow speed

6. 慢速对比

Play the original and the rebuild side by side at 0.25×. Set
recording
to a capture of the original, and the viewer plays it beside the preview on the same clock. Name every frame that drifts. A breakdown checked only at full speed is
deconstruct-compare-slowed
.
Press I and O to loop one range, such as press to release. Onion Skin ghosts the last frames over the preview. Wipe lays the recording over the preview with a divider. Crop the recording to the preview frame so the two line up.
以 0.25× 倍速并排播放 original 和 rebuild。将
recording
设置为 original 的捕获画面,viewer 会在同一时间轴上将其与 preview 并排播放。指出每一帧存在偏差的地方。仅按全速检查的拆解属于
deconstruct-compare-slowed
。
按 I 和 O 可循环播放某个区间,例如从 press 到 release。Onion Skin 会将最后几帧以残影形式叠加到 preview 上。Wipe 会用分隔线将 recording 覆盖到 preview 上。裁剪 recording,使其与 preview frame 对齐。

7. Hand back the data

7. 交付数据

timeline.js
is the hand-back: the state table and the tracks as one object. The rebuild imports that file rather than a copy, so the viewer and the shipped motion read the same values. A timeline that lives only in the reply is
deconstruct-timeline-as-data
. Copy Timeline writes the open page back into that object. Paste it over
timeline.js
. If the clipboard is blocked, the toast says Copy Failed. An edit left only in the open page is
deconstruct-copy-the-timeline
. Gate the viewer to development or delete it before release, and keep
timeline.js
.
交付物是
timeline.js
:将状态表和轨道放在同一个对象中。rebuild 应导入该文件,而不是复制一份,这样 viewer 和最终发布的 motion 会读取相同数值。只存在于回复中的 timeline 属于
deconstruct-timeline-as-data
。Copy Timeline 会将当前打开页面中的内容写回该对象。将它粘贴并覆盖 timeline.js。如果剪贴板被阻止,toast 会显示 Copy Failed。只在打开的页面中保留而未写回文件的编辑属于
deconstruct-copy-the-timeline
。发布前,应将 viewer 限制为仅在开发环境中使用,或直接将其删除,并保留 timeline.js。

The pair

成对检查

Every check is a pair. The broken line sits beside the line that replaces it.
RuleBrokenReplacement
deconstruct-capture-the-source
A breakdown from watching it onceThe code read and frames stepped at 0.1×
deconstruct-name-the-states
"It shrinks, then spins"Idle, Pressed, Copying and Copied with their events
deconstruct-every-property
"About 300ms"Scale
1
to
0.96
, 120ms, ease-out, at 400ms
deconstruct-keep-the-curve
A spring approximated as
ease-out
stiffness: 400, damping: 30
as written
deconstruct-one-clock
A CSS replay buttonEvery frame computed from one
t
deconstruct-scrub-the-timeline
A looping preview onlyA scrubber, play, pause and 0.25×
deconstruct-shipped-viewer
A viewer page written from scratch
viewer.html
copied, only
timeline.js
written
deconstruct-compare-slowed
Checked once at full speedOriginal and rebuild side by side at 0.25×
deconstruct-timeline-as-data
A timeline described in the reply
timeline.js
, imported by the rebuild
deconstruct-edit-the-segment
"Make the press 80ms"Duration edited on the segment
deconstruct-copy-the-timeline
The edit left in the open pagePasted back over
timeline.js
每个检查项都由问题方案与替代方案成对呈现。问题方案与替代方案并排显示。
规则问题方案替代方案
deconstruct-capture-the-source
仅观看一次得出的拆解读取代码,并以 0.1× 逐帧查看
deconstruct-name-the-states
"它先缩小,然后旋转"Idle、Pressed、Copying 和 Copied,并附上对应事件
deconstruct-every-property
"大约 300ms"Scale 从
1
到
0.96
,120ms,ease-out,在 400ms 时触发
deconstruct-keep-the-curve
将 spring 近似为
ease-out
按原样写入
stiffness: 400, damping: 30
deconstruct-one-clock
CSS 重播按钮根据单个
t
计算每一帧
deconstruct-scrub-the-timeline
仅提供循环预览scrubber、play、pause 和 0.25×
deconstruct-shipped-viewer
从头编写 viewer 页面复制
viewer.html
,仅编写
timeline.js
deconstruct-compare-slowed
仅按全速检查一次以 0.25× 并排播放 original 和 rebuild
deconstruct-timeline-as-data
仅在回复中描述 timeline由 rebuild 导入
timeline.js
deconstruct-edit-the-segment
"将 press 设为 80ms"直接在 segment 上编辑 duration
deconstruct-copy-the-timeline
编辑仅留在打开的页面中粘贴回并覆盖
timeline.js

Reporting

报告

Severity.
HIGH
is a breakdown made without opening the source, or a missing state.
MEDIUM
is an estimated timing, a flattened curve, a viewer that cannot scrub, a hand-written viewer or an edit left only in the page.
LOW
is drift found and named at slow speed.
Format. One finding per root cause:
file:line - [rule-id] what is wrong
Then a
Rule | Count | Severity
summary.
Block
when any
HIGH
remains,
Approve
otherwise. Mark every value you could not read from the source as
Not verified
.
严重程度。 未打开源文件就完成拆解,或缺少状态,属于
HIGH
。估算的时序、被压平的曲线、无法拖动定位的 viewer、手写的 viewer,或仅留在页面中的编辑,属于
MEDIUM
。在慢速播放中发现并指出的偏差,属于
LOW
。
格式。 每个根本原因对应一项发现:
file:line - [rule-id] what is wrong
然后提供
Rule | Count | Severity
汇总。只要仍有任何
HIGH
,就标记为
Block
;否则标记为
Approve
。将所有无法从源文件读取的值标记为
Not verified
。