一个产品“丝滑”,往往不是每个动画都更慢、更柔和,而是界面状态之间没有无缘无故的断裂。

用户点了一行,行标题不应该消失,然后另一个页面从右侧滑进来。更好的做法是让这行标题直接长成页面标题,图片延展成头图,原页面标题则收进返回按钮。

这就是连续性:用户刚才碰到的元素,应该成为下一个状态的一部分。

跳变来自“旧状态消失,新状态出现”

常见的断裂有三种:

  • 直接硬切;
  • 整页交叉淡化;
  • 新界面从与触发位置无关的方向滑入。

它们都能让状态发生变化,却没有回答“我是从哪里来的”。连续性要求把起点和终点看成同一件事的两个尺寸,而不是两张互不相干的页面。

原推文用 iOS 的七个场景展示了同一原则:

  • Navigation:行标题延续为页面标题,原标题收为返回按钮;
  • Card:卡片展开为正文,图片延展成头图;
  • Player:迷你播放条展开为播放页;
  • Search:搜索框上移,匹配项随之重排;
  • Chart:数据卡片展开为图表,小柱延续为大柱;
  • Menu:菜单从按钮原位展开;
  • Tab Bar:选中胶囊先伸展,再落位。

场景不同,但用户始终能追踪“刚才那件东西去哪了”。

一个元素,不是两张图

共享元素的核心不是做两套内容再交叉淡化,而是让同一个元素从起点移动到终点,或者由框架通过 ID 匹配成同一个共享元素。

实现时要:

  1. 测量元素在旧状态的位置和尺寸;
  2. 切换页面或组件状态;
  3. 测量新位置;
  4. 用 transform 从旧位置反向动画到新位置。

不要逐帧改变会触发重排的 width、height、top 或 margin。真实布局应该直接落在最终位置,运动由位移和缩放完成。

文字从一个小标题变成大标题时,应该平滑缩放同一段文字,而不是让两份不同字号的内容交叉淡化。只有某一个状态才存在的内容,才使用淡入淡出:

  • 新状态独有的内容,在移动完成约 45–55% 后淡入;
  • 旧状态独有的内容,在前 25–35% 淡出。

这条规则会避免用户在过渡中看到两套文案同时存在。

卡片、行和详情页共享同一条路径

行变成详情页

列表项的标题长成详情页大标题,缩略图扩展为页头图片,上一页的大标题缩进返回区域。

页面向下滚动时,大标题再收进顶栏;向上返回时,所有关系逆向发生。返回手势和返回按钮必须驱动同一段动画,不能一个走手势、一个走另一套路由过渡。

卡片变成全屏或对话框

卡片的框架、圆角和图片一起展开。标题保持同一行文本来缩放,其余正文在卡片基本打开后才淡入。

关闭时,或向下拖动卡片时,沿同一条路径缩回原来的卡片位置。

迷你条变成完整面板

迷你播放器、聊天气泡、上传或下载胶囊,都可以直接变成完整面板。

封面、标题和主要按钮不是复制一份到新容器,而是各自从迷你位置长到目标位置。面板在所有帧里都保持不透明,背后的页面缩到约 0.94,并降低约 30% 明度。

搜索、图表和菜单也属于连续性

搜索与筛选

搜索框移动到顶部,页面标题离开,取消按钮进入。输入过程中,匹配项从当前位置移动到结果位置,其余项目淡出。

桌面端的命令面板从搜索框原位展开,是同一模式的另一套尺寸。

摘要进入详情

数据卡片展开为图表时,缩略折线应成为图表的线,小柱应成为图表的柱,标签移动到标题位置,数字直接放大,而不是先消失再重新绘制。

控制器打开它控制的内容

⋯、+、选择器或日期字段打开菜单与面板时,面板要从触发控件自己的角落长出来。菜单项在面板基本展开后出现,每项间隔约 25ms。

新增、删除或移动项目时,各项直接在自己的最终位置出现或让位,不能先消失再重排。

标签栏的指示器要会“追赶”

标签、分段控件和侧边导航中,不应该出现两个胶囊一个淡出一个淡入。

同一个指示器从旧标签移动到新标签。前缘先离开,后缘随后跟上,所以它在途中会伸展,落地时再收稳。最长处只需要约 15% 的高度压缩,足够表现惯性,又不会像橡皮糖。

标签文字折叠和展开的同时,其他标签让出空间。新内容从用户选中的方向进入。

布局变化只允许位置连续

网格与列表切换、排序、插入、删除、展开与折叠时,每个项目都从自己的旧位置移动到新位置。

跨行项目尤其要注意:离开当前行时从行尾退出,进入下一行时从行首出现,不能让它直接斜穿整个网格,看起来像导航错误。

布局变化不等于窗口尺寸变化。响应式断点与窗口缩放不应该被当作交互动画,直接重新布局。

层级、圆角和内容交接

增长中的面板必须全程不透明,不能让背后内容透过中间帧。移动的元素在运动时位于邻居上方,落位后回到原本的层叠顺序。

圆角也要连续变化,并使用产品自己的曲率;嵌套容器继续遵守同心圆角与相等内边距。

最终状态的真实组件出现时,第一帧必须与动画结束帧完全对齐。只要位置、尺寸、圆角或文字基线差一像素,交接就会闪一下。接缝正是连续性最容易露馅的地方。

时长由变化尺度决定

默认可以使用快起、长收的曲线:

1
cubic-bezier(0.32, 0.72, 0, 1)

手机端:

  • 变成全屏的转场约 450–700ms;
  • 菜单与 Sheet 约 350–500ms;
  • 指示器移动约 400–450ms;
  • 屏幕内移动使用 ease-in-out。

桌面端约为手机时长的三分之二;键盘触发的动作还可以更短。多项内容的交错延迟保持在 20–50ms,不能让用户逐项等完。

拖动过程中必须 1:1 跟随手指或指针,被拖拽卡片可以逐渐缩到约 0.82。松手后从当前速度继续,朝更近的端点收束。

新动作从当前状态接管

转场不阻塞输入。用户快速重复点击、在动画中返回、拖动到一半取消,都必须从当前视觉状态继续,而不是等上一段动画播完再响应。

减少动态效果时,保留状态变化和约 150ms 的交叉淡化,去掉位移与缩放。焦点要进入新状态的标题或第一个控件,关闭后回到原来的触发元素,读屏对状态的宣布保持正常。

桌面端只改变发生变化的窗格

桌面不是把手机的整屏转场简单缩小。

卡片或列表项通常展开为侧栏或对话框,因此从卡片位置长到面板位置。不要缩放眼整个窗口,也不要在 hover 时触发布局动画。

元素运动期间,指针目标仍要停在实际可点击的位置,保证用户第二次点击落在自己看到的地方。分栏界面只在发生变化的那一栏里做动画。

先诊断,再改造

连续性不是全站统一加一套转场。应该先找出真正让用户迷失的跳变,再按频率、迷失程度和改造成本排序。

每个候选项都要记录:

  • 位置与触发动作;
  • 现在发生了什么;
  • 对应哪一种连续性模式;
  • 哪个元素应该被延续;
  • 起点、终点、时长和曲线;
  • 用户价值是高频、中频还是低频;
  • 代码成本,以及路由、虚拟列表、共享状态等风险。

最多先列 10 个,从高频、容易迷路且成本低的开始。先给出诊断表,等确认后再一次改一个。

平台工具不同,原则相同

平台 共享元素与转场
Web View Transitions API、view-transition-name、FLIP
Motion / Vue / Svelte layoutId、layout、TransitionGroup、flip 与 crossfade
iOS 18+ matchedGeometryEffect、zoom navigation transition
Android Compose SharedTransitionLayout、sharedElement、predictive back
Flutter Hero、OpenContainer、AnimatedList
Electron / Tauri Web 方案,注意系统 WebView 对 View Transitions 的支持

无论使用哪套 API,最终都要验证同一组边界:首尾帧准确、真实长短文本、缺图、首尾项、空列表、滚动列表、快速重复操作、返回中断、手势取消、手机与桌面、深浅模式、键盘、读屏与减少动态效果。

检查清单

  • 用户触碰的元素是否真的延续到下一个状态;
  • 是否只移动一个共享元素,而不是两套内容交叉淡化;
  • 是否只动画 transform、opacity,避免布局属性;
  • 新状态独有内容和旧状态独有内容的淡入淡出时机是否正确;
  • 面板是否全程不透明,层叠顺序是否在落位后恢复;
  • 圆角与连续曲率是否沿同一条路径变化;
  • 最终真实组件与动画结束帧是否完全对齐;
  • 返回手势是否与按钮转场共用同一动画;
  • 快速重复操作与中断是否从当前状态接管;
  • 手机、桌面、键盘、读屏和减少动态效果是否都验证。

连续性改造示例 Prompt

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
Prompt

Find the places in my product where the interface jumps from one state to the next, and make the important ones continuous: the element I touched should carry into what comes next instead of disappearing and being replaced. First diagnose and suggest; build only what I pick.

This is a change to my product, not a demo. Work inside my code, on my stack, with my components, tokens and layout. Keep what every action does, what each screen shows and where things end up; change only how one state becomes the next. Do not copy a demo scene (no phone frame, backdrop, sample content or fonts). Do not add a dependency or a router change without asking. Every value below is a default to start from. It applies to phone and desktop layouts alike; section 3 says where they differ.

0. Read the product first
- Find the screens, routes, panels, sheets, dialogs, menus and lists, and how one opens from another: navigation stack or router, modal and sheet presenters, popover and menu components, list and grid components.
- Find what animates today and how: CSS transitions, the View Transitions API, Motion or Framer Motion, GSAP, SwiftUI or UIKit transitions, Compose animations, Flutter Hero or implicit animations. Note the motion tokens (durations, curves, springs) and reduced-motion handling, and reuse them.
- Note which layouts exist (phone, tablet, desktop window, split view) and the input on each (touch, mouse, keyboard).
- Tell me in a few lines what you found before going on.

1. What to look for
A jump is where I act on one element and the next state appears from nowhere: a hard cut, a cross-fade of whole screens, or something sliding in from an unrelated edge. Look for these, the most common first:
a. A row or item opens its detail page. Continuous: the row's title grows into the page title; its picture into the header; the previous page's title shrinks into the back button. When the page scrolls, the large title tucks into the top bar, centred on the control row. Going back reverses all of it.
b. A card opens into a full view or a dialog. Continuous: the card itself grows into the view (its frame, corners and picture), its title stays the same line of type and only scales, and the rest fades in once the card is mostly open. Closing, or dragging it down, shrinks it back into the same card in the same place.
c. A compact bar opens into a full panel: a mini player, a chat bubble, an upload or download pill, a toast with details. Continuous: the bar is the panel; its cover, title and main button grow into their places in it. The panel stays opaque all the way, and the page behind steps back (scale about 0.94, dimmed about 30%).
d. Search or filter. Continuous: the field moves up into the top row as the page title leaves and a Cancel or close slides in; while typing, the matching items slide from where they are to their place in the results and the rest fade out. On desktop the same applies to a command palette opening from its field.
e. A summary opens into its detail: a metric tile into a chart, a progress ring into a report, a thumbnail into a gallery. Continuous: the small marks become the large ones (the sparkline is the chart's line, the small bars are the chart's bars), the label moves into the title, and the number scales up rather than being redrawn.
f. A control opens what it controls: a ⋯ or + button into its menu or form, a select into its list, a date field into its picker. Continuous: the panel grows out of the control from the control's own corner, its items fade in after it is mostly open (about 25ms apart), and the highlight slides from item to item with the pointer or finger. When an action adds, removes or moves something, it appears in its place and the others move to make room; nothing jumps.
g. Tabs, segmented controls, bottom bars and side navigation. Continuous: one indicator travels from the old tab to the new one. Its leading edge leaves first and the trailing edge follows, so it stretches on the way and settles as it lands (a small squash of about 15% of its height at the longest is enough); labels collapse and expand while the other items make room. New content enters from the side of the tab that was chosen.
h. Layout changes: grid to list, sort, reorder, insert, delete, expand and collapse. Continuous: each item moves from where it was to where it goes; items that change row leave at the end of their row and come in at the start of the next, so nothing crosses the grid.

2. How to make it continuous
- One element, not two. The thing that moves is the same element (or a shared element the framework matches by id), measured where it starts and where it ends. Animate between the two boxes with transforms; never animate width, height, top or margin on things that reflow.
- What only one state has fades: content that exists only at the end fades in after about 45-55% of the move, and content that exists only at the start fades out in the first 25-35%. Text that changes size scales; it is not cross-faded with a copy.
- Keep layers honest: a panel that grows is opaque all the way, so nothing shows through it; the moving element stays above its neighbours while it moves, and goes back to its place in the stack when it lands.
- Shapes keep their corners: the radius changes smoothly between start and end, using the product's own corner curve. Nested shapes keep equal padding and concentric corners.
- Timing: open and close with a fast start and a long settle, cubic-bezier(.32, .72, 0, 1) or the product's own spring. Phones: 450-700ms for something that becomes a full screen, 350-500ms for menus and sheets, 400-450ms for an indicator. Desktop: about two thirds of that, and shorter still when it was triggered from the keyboard. Moves within a screen use ease-in-out. Staggers stay between 20 and 50ms.
- Gestures: while a finger or the pointer drags, follow it 1:1 (a dragged card shrinks to about 0.82 as it goes); on release, finish with the release velocity, toward whichever end is nearer.
- Interruptions: a new action takes over from wherever the animation is; nothing waits for an animation to finish, and input is never blocked.
- Reduced motion: keep the change of state and a short cross-fade (about 150ms), drop the movement and scaling.
- Accessibility: focus moves to the new state's heading or first control, and back to the element that opened it when it closes; screen readers announce the new state as they do now.

3. Phone and desktop
- Phone: everything above, with gestures (swipe back, drag to dismiss) driving the same animation as the buttons, and safe areas respected at every frame.
- Desktop: the same patterns, smaller and quicker. A card or row usually opens into a side panel or dialog rather than a full window; grow it from the card into that panel. Do not zoom whole windows. Hover never starts a layout animation. Keep pointer targets in place while they animate, so a second click lands where it aims. In split views, animate inside the pane that changes.
- Window resizing and responsive breakpoints are not transitions; do not animate them.

4. Report before building
Go through the product and give me a ranked list, at most 10 entries, each with:
- Where: the screen or component, and the action that triggers it (on phone, desktop or both).
- Now: what happens today, in one line.
- Pattern: which of a-h it is, and which element should carry over.
- Change: what moves to where, the duration and curve, in two or three lines.
- Value: high, medium or low, from how often people do it and how lost they could get without it.
- Cost: what has to change in the code, and any risk (routing, virtualized lists, shared state).
Put the frequent, disorienting ones with low cost first. Then ask me which ones to build and wait.

5. Build what I pick
- Describe the approach for each on my platform (section 6 is a starting point), and list the files you will touch. Wait for my go-ahead.
- Build them one at a time. For each, list the files you touched, and check:
- The first and last frame match the real states exactly; nothing jumps when the moving element hands over to the real one.
- Real data: long and short text, missing images, the first and last item, an empty list, a scrolled list.
- Fast repeated taps or clicks, going back during the animation, and gestures cancelled half way.
- Phone and desktop layouts, light and dark, reduced motion, keyboard and screen reader.
- At rest every screen looks exactly as before, and existing tests still pass.

6. How, by platform (check against my versions)
- Web: the View Transitions API with view-transition-name on the shared elements (same-document, and cross-document where pages are separate), with a plain update as the fallback. Otherwise FLIP: measure first, apply the change, measure last, animate the inverse with transforms (Motion's layout and layoutId do this; so do Svelte's flip and crossfade, and Vue's TransitionGroup). For router-driven pages, start the transition from the router's navigation hook.
- iOS: SwiftUI matchedGeometryEffect for shared elements in one view, navigationTransition(.zoom(sourceID:in:)) with matchedTransitionSource on iOS 18 and later for pushes and sheets; UIKit preferredTransition = .zoom on iOS 18, or a custom UIViewControllerAnimatedTransitioning with UIViewPropertyAnimator for interruptible, gesture-driven ones.
- Android: Compose SharedTransitionLayout with Modifier.sharedElement and sharedBounds, AnimatedContent, Modifier.animateItem for lists, and predictive back for gesture-driven returns; with Views, MaterialContainerTransform and shared element transitions.
- Flutter: Hero for shared elements between routes, OpenContainer from the animations package for card to page, AnimatedList and implicit animations for layout changes.
- Desktop apps: Electron and Tauri take the web route (Tauri uses the system WebView, so test View Transitions there and keep the fallback); native apps use the same ideas with their own animation tools.

质感来自可解释的细节

连续性的本质,是让界面承认用户刚做了什么。

共享元素说明“你点的东西还在”;层级、圆角和文字交接说明“它变成了什么”;手势与反向转场说明“你可以沿原路回来”。状态没有断裂,产品才会显得理解用户,而不是只在切换页面。

站内搜索

没有找到内容!