Vibe Design Tips

讓元件的進場更細緻

Elastic Entrances

讓元件的進場更細緻

動態元件

元件與畫面的進場由位移、形變與透明度交織而成:涵蓋適度的慣性與回彈、順應觸發方向展開、先快後慢的節奏、關聯元素連動與外框內容錯開進場 5 項動態設計原則。

在產品設計裡,元件與畫面的進場不只是單純的淡入淡出或平移。如果選單、對話框只是原地漸顯,或是千篇一律從中心等比放大,視覺上就像憑空冒出來,與前一步操作缺乏連結。細膩的進場往往要把位移、形變與透明度變化搭配運用:移動的方向與動態曲線、形變的幅度與周遭元素的連動、透明度的起始值與變化速度,都會共同左右最終的質感。以下從 5 個設計細節出發,說明這些變化如何互相配合。

適度的慣性與回彈

真實世界裡的物體帶有慣性,不會在抵達終點的瞬間戛然而止。選單、下拉選單、內容較精簡的對話框等展開式元件,進場落定時帶一點輕微回彈,會比生硬停住更自然、更有彈性。不過回彈幅度必須克制在幾個百分點以內,並遵循「元件越大,回彈越小」的原則:小巧的選單輕彈一下顯得靈活,中等面板就要明顯收斂,至於側邊抽屜、底部面板與整頁切換則完全不回彈——面積越大,回彈帶來的畫面晃動感就越強烈。同樣地,收合退場的目的是迅速讓出視線,也不需要回彈。

從觸發元素的方向展開

點擊或游標停留時,使用者的視線原本就落在觸發元素上。有明確觸發來源的元件——例如提示框、下拉選單、多層子選單、手風琴——應順著觸發元素所在的方向生長出來:將起點放在靠近觸發元素的一側,沿著展開方向先壓扁再恢復原狀。比方說從按鈕下方展開的選單,縱向壓扁而橫向幾乎不變,看起來像是從按鈕裡往下舒展,而不是從半空中放大;從側邊伸出的子選單改為橫向壓扁,右側空間不足翻往左側時,展開起點也隨之翻轉;點擊連結或圖片開啟的預覽視窗,則直接從點擊的位置綻開。唯有沒有明確觸發位置的置中面板,才適合從中心均勻縮放。交代清楚元件的來處,視覺上更連貫,操作起來也更順手。

節奏要俐落

工具型介面的動態效果是為了順暢銜接狀態,而不是讓使用者停下來看動畫。進場應多採用先快後慢的曲線(詳見 011 依情境選擇動畫節奏與緩動曲線),點擊瞬間元件就已經到位大半,只留尾段輕柔落定,反應感最為俐落。這裡有兩個容易忽略的設計細節:一是透明度要比形變先完成,在回彈或落定前元件就已經完全清晰,避免在半透明狀態下邊顯影邊晃動;二是變化越快,幅度就要越小,節奏越短促,移動與縮放的跨度就越要收斂,否則短時間內的劇烈跳動反而刺眼。

讓關聯元素一起變化

新元件並不是孤立出現的,周圍元素的配合能自然拉開空間層次,這也是 iOS 中常見的設計手法。在前後層級上,當預覽視窗、對話框或抽屜浮現時,讓底層頁面向後略微縮小並加上模糊,視線焦點會自然聚攏到前景,前後關係一目了然;在同層版面上,手風琴展開時下方區塊同步下移,列表插入新項目或跳出新 Toast 時周圍元素平滑讓出空間,避免生硬擠壓。尤其要注意只讓新出現的元件回彈,背景絕不回彈——背景承擔著穩定視線的參照作用,一旦跟著回彈,整個畫面就會失去重心。

外框與內容錯開進場

如果外框與內部所有圖示、文字在同一瞬間整齊劃一地出現,元件容易顯得像一塊生硬的貼圖。讓各部分的起點略有先後,哪怕完全不做回彈,動畫也會立刻多出呼吸感與層次。以選取文字後浮現的工具列為例:先展開外層容器,再讓內部按鈕緊隨其後輕輕滑入,視覺上就有了向外延伸與生長的感覺。手風琴先撐開面板再顯出內文、預覽視窗主體先落定再浮現角落按鈕,都是同樣的思路;列表或卡片群組依序錯開進場時,只需錯開最前面的幾項,其餘一併呈現,既有節奏又不會拖慢瀏覽。

交給 AI 來做

將下方 Prompt 複製給 Claude Code、Codex、Cursor、WorkBuddy 等 AI 工具:它會先盤點專案裡各類元件與區塊的進場效果——涵蓋選單、對話框、預覽視窗、工具列,以及提示框、手風琴、列表、Toast 與頁面切換——提出診斷與調整方案等你確認。各情境對應的推薦曲線與具體參數均已整理在 Prompt 內,也可依需求產生一個與本頁示範同款的調整面板,用滑桿在真實介面上直覺微調手感。

Prompt複製後傳給 Claude Code、Codex、Cursor、WorkBuddy 等 Agent
Refine how things come into view in my product: every component and module that appears, opens, expands or is replaced. That covers overlays (menus, submenus, dropdowns, popovers, tooltips, hover cards, dialogs, sheets, drawers, command palettes, previews opened by a click), floating toolbars, toasts and banners, accordions and expanding sections, lists, grids and cards as they load or change, tab panels, and page or route changes. An entrance is never only a fade or a slide: movement, deformation and opacity work together, and so do the elements around the one that enters. A tuning panel shows the key numbers as sliders, set to the defaults below, so I can tune them live on my own screens. Diagnose first, and change only what I approve.

This is a change to my product, not a demo. Work inside my code, on my stack, with my components and motion tokens. Keep what each element shows, where it ends up and what triggers it; change only how it comes in, goes out and moves what is around it. Do not add a dependency without asking. Every value below is a default to start from.

0. Read the product first
- Find everything that appears or changes in place, and the component behind each: my own, or a library (Radix, Headless UI, Floating UI, MUI, Ant Design, Motion / Framer Motion, React Spring, View Transitions, SwiftUI, Compose).
- For each, note what triggers it (a button, a row in another menu, hover, a shortcut, a click on content, a text selection, data arriving, navigation), which way it comes from (down, up, a side, an edge of the window, centred, the point clicked), its size, what around it should react, and how it animates today: transform, origin, duration, curve, opacity, and whether a close interrupts an open cleanly.
- Find the motion tokens (durations, curves, springs), how reduced motion is handled, and my slider, segmented-control and panel components, if any.
- Tell me in a few lines what you found, then ask me where the tuning panel (section 4) should live: only in development (recommended), behind a toggle, or not at all.

1. Five principles for every entrance
a. A little bounce, sized to the element. Small things that open from a trigger (menus, popovers, small dialogs, chips) may run a few percent past their end and settle. The larger the element, the less it bounces: about 3% of its size at most for a large window, none for sheets, drawers, full panels and pages. Text never bounces on its own, and the page behind never bounces.
b. Come from where it was triggered. Put the transform origin on the trigger's side (the corner by the button, the edge by the parent, the point clicked) and start 6-8px back toward it. Squash it along the way it opens, about 0.86 along that axis and 0.96 across it, and turn the squash and the offset with the direction when it flips. An element with no trigger (a centred palette, a page) scales evenly instead; one that slides in from an edge comes from that edge.
c. Fast, and smaller the faster it is. Use fast-in, slow-out curves: cubic-bezier(0.22, 1, 0.36, 1) by default, cubic-bezier(0.2, 1.45, 0.35, 1) where a small overlay should bounce. Most entrances take 150-360ms. Opacity finishes in about half the transform's time, so the element is fully shown before it settles. The shorter the motion, the smaller its change: a 120ms entrance moves at most 4px and scales from 0.98; a 360ms one may squash to 0.86. Leaving is shorter, about 140-160ms on ease-in, with no bounce.
d. Related elements move with it. Behind a dialog or preview, the content recedes to scale(0.95) and blurs about 4px over 360ms on cubic-bezier(0.2, 0.9, 0.1, 1), into its own background colour, without a bounce. Elements that share the space make room on the same curve and time as the one entering: the content under an expanding section moves down with its height, list items close up or open a gap, a stack of toasts shifts. An element that continues from one state to the next (a card that opens into a page) moves as one rather than being swapped.
e. Container first, content after. The surface or container leads; the content inside starts 20-30ms later, sliding in from 4% of the width (6-10px) and from opacity 0.72 or 0; the items of a list or grid follow 20-40ms apart, up to about eight, then the rest together. The lag between the layers gives the give.

2. Measured presets
a. Menu or dropdown below or above its trigger: origin the corner nearest the trigger; from translateY(-6px) scale(0.96, 0.86), the offset pointing back toward the trigger; transform 360ms cubic-bezier(0.2, 1.45, 0.35, 1) (about 6.6% past the end); opacity 170ms ease.
b. Submenu to one side: from translateX(-8px) scale(0.88, 0.98) with origin left center when it opens to the right; translateX(8px) and origin right center when it flips left. Same curve and opacity as a.
c. Panel centred on the window (command palette, search, centred dialog): origin center, from translateY(8px) scale(0.94); a spring with a damping ratio of about 0.68 landing in 180ms (about 5% overshoot), as CSS linear(0, 0.0617, 0.2047, 0.3798, 0.5541, 0.708, 0.8325, 0.9253, 0.9888, 1.0278, 1.0478, 1.0542, 1.0518, 1.0446, 1.0352, 1.0256, 1.0171, 1.01, 1.0047, 1.0011, 1), falling back to 150ms cubic-bezier(0.18, 1.32, 0.32, 1); opacity 80ms ease-out. If it opens more than about 280ms after the key press, show it at once without the entrance.
d. Window opened by a click on content (link or file preview, image viewer, card detail): origin the point clicked, clamped inside the window; from scale(0.78) on a spring with stiffness 600 and damping 26 (about 540ms, about 3% overshoot in size); opacity 110ms ease-out. The content behind recedes as in principle d. The window's own buttons follow 60ms later from scale(0.7) on a softer spring (stiffness 640, damping 38).
e. Toolbar over content (text selection, floating actions): no overshoot. The surface fades in over 140ms and settles from translateY(-3px) scale(0.96) over 160ms, both ease. Its material widens from 0 over 240ms, the content area 20ms behind over 260ms, and the buttons slide in from 6-10px to the left, from opacity 0.72, over 280ms starting 30ms in, all on cubic-bezier(0.22, 1, 0.36, 1).
f. Tooltip and hover card: from the side of the trigger, translate 4px toward it and scale(0.97), 140ms cubic-bezier(0.22, 1, 0.36, 1), opacity 100ms. No bounce.
g. Accordion or expanding section: the height grows from 0 to its content (interpolate-size: allow-keywords, grid-template-rows from 0fr to 1fr, or a measured height) over 280ms cubic-bezier(0.22, 1, 0.36, 1), and what is below moves with it. The content fades in and slides 6px down, starting 40ms in; the chevron turns on the same curve. Collapsing takes 200ms, the content fading out first.
h. List, grid or cards loading or changing: items rise 8px and fade in, 30ms apart, about eight at most, the rest together. A new item opens its own height from 0 while the others make room, then fades in; a removed one fades, then closes its gap.
i. Toast or banner: from the edge it lives on, 12px out and scale(0.96), on a spring with stiffness 600 and damping 30; the toasts already shown shift on the same spring.
j. Tab panel, sheet, drawer or page change: the outgoing view fades out over 120ms and moves 8px away from the direction of travel; the incoming one comes 8px from that direction over 240ms on cubic-bezier(0.22, 1, 0.36, 1), opacity 160ms. Sheets and drawers slide from their edge with no overshoot, the page behind receding as in principle d.

3. Rules for every one
- Animate transform and opacity (and heights or widths where the layout must move), and clear will-change when the motion ends.
- A close or a new open interrupts the running motion from where it is, never from its start; opening and closing quickly never leaves an element stuck part-way, half transparent or in the wrong place.
- When an element is already placed with a transform (centring with translate(-50%)), add the entrance on top of it (the Web Animations API with composite: 'add') so it lands where it was.
- Springs: in CSS, sample the spring into linear() so it runs on the compositor. Libraries that take stiffness and damping (Motion, React Spring) use the numbers above with mass 1; SwiftUI and Compose take the damping ratio and a duration or response.
- Reduced motion: no squash, offset, stagger or bounce; opacity only, and layout changes happen at once.

4. The tuning panel
- A small floating panel that tunes the entrances live on my real screens. A tab for each kind my product uses (the presets in section 2); under the tabs, one row per value: its name, a slider with the default marked on the track, and the value with its unit in a box.
- Rows, defaults and ranges:
  - Menu: Squash, the height it starts at, 0.86 (0.5-1); Offset 6px (0-24); Bounce, the curve's overshoot: cubic-bezier(0.2, y1, 0.35, 1) with y1 1.45 (1-2.2), shown as its overshoot, +6.6% (0-33%).
  - Submenu: Squash, the width it starts at, 0.88 (0.5-1); Offset 8px (0-24); Bounce as for menus.
  - Panel: Start scale 0.94 (0.6-1); Damping ratio 0.68 (0.35-1).
  - Preview: Start scale 0.78 (0.5-1); Damping 26 at stiffness 600 (16-50).
  - Toolbar: Lag, how far the buttons trail the surface, 30ms (0-120), the content area trailing by two thirds of it; Slide 10px (0-40).
  - For the other kinds: Duration, Offset and Stagger, at the values above.
  - On every tab: Speed, a factor on every duration, 1 (0.5-2).
- Beside the tabs, a speed switch (1x and 0.25x) and a Replay button that plays the current element again at that speed; letting go of a slider replays it too. A Reset button, shown only once something has moved, puts the kind back to its defaults.
- Under the rows, the curve: progress over time, with the overshoot's peak marked and its time in ms; it changes as the sliders move.
- The panel writes the same motion tokens the components read, and a Copy button copies the current values in my project's token format, so what I settle on goes back into the code.
- Use my slider and segmented-control components if I have them; otherwise a plain range input with an outlined track filled up to the value, an upright handle and a number box beside it, and tabs with a sliding knob.

5. The report
Before changing anything, give me one table, one row per element:
| Element | Triggered by, from where | Preset (2a-2j) | Today (transform, origin, duration, curve, what moves around it) | Change |
Then list the shared changes (motion tokens, a spring helper, a stagger helper, the surface components) separately from the per-element ones. Ask me which rows to change, and change only those.

6. Check the result
- Slow everything down (DevTools' animation panel at 25%) and check each element: it comes from its trigger, squashed along the way it opens, is fully visible before it settles, and bounces no more than its size allows.
- A submenu that flips to the left squashes and offsets from its right edge; a preview grows from the exact point clicked; the page behind never bounces.
- Content under an accordion, items around a new list entry and stacked toasts move on the same curve as the element that changed, with no jump.
- Containers lead and their content follows; lists stagger and stop staggering after about eight items.
- Opening and closing quickly many times never leaves anything stuck, half transparent or in the wrong place.
- With reduced motion on, everything only fades.
- Every slider moves its element live; Reset brings back the defaults above.