Interaction Details (Follow · Threshold · Snap) new 高级交互细节(跟随 · 阈值 · 吸附) web

01/10

标本可交互,可以直接操作。

Anatomy — every part, named解剖 —— 每个部件的名字

  1. 1 Stack to fan卡堆扇形展开 transform-origin

    Cards rotate around one origin far below them, so the stack opens like a fan; open and closed share one layout.

    几张卡绕卡片下方远处的同一个原点旋转,收起和展开共用一套布局。

    Prompt fragmentPrompt 片段

    cards rotating around a transform-origin far below the stack

    卡片绕卡堆下方远处的 transform-origin 旋转

  2. 2 Wheel picker snap滚轮选择吸附 velocity decay

    After release, velocity decays every frame and the wheel snaps to a row only when nearly stopped.

    松手后速度逐帧衰减,快停住时才吸附到最近一格。

    Prompt fragmentPrompt 片段

    inertia that decays per frame, then a snap to the nearest row below a speed threshold

    逐帧衰减的惯性,低于速度阈值后吸附到最近一格

  3. 3 Sheet dismiss半屏浮层关闭 distance or velocity

    A draggable sheet closes when either the drag distance or the release speed passes its threshold.

    可拖动的浮层,拖动距离或松手速度任一过阈值就关闭。

    Prompt fragmentPrompt 片段

    a draggable sheet that closes past 40% height or above a release speed

    拖过 40% 高度或松手速度够快就关闭的浮层

  4. 4 Fly to cart加购飞入 two-layer transform

    An item flies on an arc built from a linear x layer and an ease-out y layer.

    商品沿弧线飞入,弧线由横向匀速和纵向缓出两层叠成。

    Prompt fragmentPrompt 片段

    an outer layer moving x linearly and an inner layer moving y with ease-out

    外层横向 linear、内层纵向 ease-out 叠成的弧线

  5. 5 Large title collapse大标题折叠 scroll progress

    Title scale, position and bar background all derive from one scroll progress value.

    标题缩放、位移和导航栏底色都由同一个滚动进度算出。

    Prompt fragmentPrompt 片段

    title scale, x, y and bar background derived from one 0→1 scroll progress

    标题缩放、横移、上移和底色都由同一个 0→1 进度计算

  6. 6 Drag reorder拖拽排序 array order

    Only the array order changes; the dragged row has no transition, the others animate to make room.

    只改数组顺序;被拖的不带过渡,其余带过渡让位。

    Prompt fragmentPrompt 片段

    the dragged row without transition, the rest transitioning into new slots

    被拖的行关闭过渡,其余行带过渡移到新位置

  7. 7 Thumbnail to full (FLIP)小图变大图 FLIP

    The full image is first pinned onto the thumbnail's box, then released on the next frame to animate.

    大图先钉在小图的位置和大小上,下一帧再放开做动画。

    Prompt fragmentPrompt 片段

    the full image pinned to the thumbnail box, released on the next frame

    大图先摆到小图的位置,下一帧再过渡到最终位置

  8. 8 Handwriting with coalesced points手写笔迹补点 getCoalescedEvents

    Points the browser merged during a fast stroke are recovered so the line stays smooth.

    快速划线时把浏览器合并掉的点取回来,线条才顺。

    Prompt fragmentPrompt 片段

    strokes drawn through every point from getCoalescedEvents()

    用 getCoalescedEvents() 取回的每个点来画线

  9. 9 Pull-away badge未读拖走拉丝 distance threshold

    The root of the string shrinks with distance; release early to spring back, pull past the limit to break.

    根部随距离变细;没拉过头就弹回,拉过头才断开。

    Prompt fragmentPrompt 片段

    a root circle that shrinks with distance, springs back early and breaks past the limit

    根部随距离缩小,未到阈值弹回、超过阈值断开

  10. 10 Layered page transition页面转场层次 parallax push

    The old page shifts back and dims while the new page slides in.

    新页滑入的同时,旧页后退并变暗。

    Prompt fragmentPrompt 片段

    the old page shifting 30% left and dimming while the new page slides in

    新页滑入时旧页同时左移 30% 并压暗

Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

Build these interactions with the following details: (1) a card stack that fans out by rotating each card around a transform-origin far below the stack, using one layout for both states; (2) a wheel picker whose release velocity decays by about 0.94 per frame and snaps to the nearest row only once speed drops below a threshold; (3) a draggable bottom sheet that closes when drag distance passes 40% of its height OR release velocity passes a threshold, otherwise springs back; (4) add-to-cart that flies an item on an arc made of two nested layers, outer x linear and inner y ease-out; (5) a large title whose scale, x, y and navigation bar background are all computed from one scroll progress; (6) drag-to-reorder that only changes the array order, with transitions off for the dragged row and on for the others; (7) thumbnail-to-full with FLIP: pin the full image onto the thumbnail box, then release on the next frame; (8) handwriting that draws through getCoalescedEvents(); (9) a pull-away unread badge whose root shrinks with distance, springs back before a limit and breaks past it; (10) a page push where the old page shifts back and dims while the new page slides in. Honour prefers-reduced-motion.

按以下细节实现这些交互:(1) 卡堆展开成扇形:每张卡绕卡堆下方远处的 transform-origin 旋转,收起和展开用同一套布局;(2) 滚轮选择:松手速度每帧乘约 0.94 衰减,速度低于阈值后才吸附到最近一格;(3) 可拖动的半屏浮层:拖动超过高度 40% 或松手速度超过阈值任一满足就关闭,否则弹回;(4) 加购飞入:商品沿弧线飞向角标,弧线由两层嵌套元素组成,外层横向 linear、内层纵向 ease-out;(5) 大标题折叠:标题缩放、横移、上移和导航栏底色都由同一个滚动进度计算;(6) 拖拽排序:只改数组顺序,被拖的行关闭过渡,其余行开着过渡;(7) 小图变大图用 FLIP:先把大图钉在小图位置,下一帧再放开;(8) 手写笔迹用 getCoalescedEvents() 的每个点来画;(9) 未读角标拖走:根部随距离缩小,未到上限松手弹回,超过上限才断开;(10) 页面转场:新页滑入时,旧页同时后退并变暗。尊重 prefers-reduced-motion。

Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

Debug my interaction details. Check that the fan's transform-origin is outside the cards and both states use the same layout; the picker does not snap while inertia is still running; the sheet's close decision considers both distance and velocity; the cart arc uses two nested elements with different easings; every collapsing-title property reads the same progress value; the dragged row has transition: none while siblings keep theirs; the FLIP start frame is committed before the transition is enabled; coalesced events are used for strokes; the badge breaks only past its distance limit; and the previous page actually moves and dims during the push. The symptom:

调试我的交互细节。检查:扇形的 transform-origin 是否在卡片外,两种状态是否用同一套布局;滚轮在惯性还没结束时是否就吸附了;浮层关闭判断是否同时考虑距离和速度;加购弧线是否用了两层不同缓动的嵌套元素;折叠标题的每个属性是否读同一个进度;被拖的行是否 transition: none 而兄弟元素保留过渡;FLIP 的起始帧是否先提交再开启过渡;划线是否用了合并事件;角标是否只在超过距离上限时才断开;以及转场时上一页是否真的移动并变暗。症状是:

In code代码里叫什么

Framework框架Symbol符号Note说明
CSS transform-origin rotate a stack around a point outside the cards让卡堆绕卡片外的一点旋转
JS requestAnimationFrame + velocity *= 0.94 decay inertia frame by frame before snapping逐帧衰减惯性,再吸附
Web PointerEvent.getCoalescedEvents() recover the points merged during fast strokes取回快速划线时被合并的点
Pattern FLIP (First, Last, Invert, Play) pin to the start box, then release on the next frame先钉在起始位置,下一帧再放开
CSS transition: none on the dragged item dragged items follow the finger; the rest animate被拖的元素关闭过渡,跟手;其余带过渡
Motion useScroll + useTransform derive several properties from one scroll progress多个属性由同一个滚动进度派生

See also相关词条

我的参考集

组合知名网站、UI 元素、视觉风格和平面设计案例,导出给 AI。

你的下一份设计,从这里开始。

在任意案例旁点击「加入参考」,就能把品牌、组件、风格和平面设计案例组合成一份 AI 设计说明。

搜索参考库Search the library

输入关键词,搜索所有参考。