不少滚动动效看起来高级,是因为页面不再只是“往下走”。

卡片会叠起来、飞出去、横向移动、旋转排开,图片也会从一个小窗口长满屏幕。用户的纵向滚动被翻译成另一种运动,于是熟悉的浏览动作突然变得有空间感。

但真正的关键不是效果有多复杂,而是每一个画面都由滚动位置直接决定:停在半路,动画就停在半路;往回滚,它原样倒放。

不要触发动画,要让滚动成为时间轴

普通“进入视口后播放”的动画,一旦开始就按固定时间走完。滚动只是触发器。

滚动驱动效果不同。每个 section 有一个进度 p:

1
p = clamp((scrollY - start) / distance, 0, 1)

位移、缩放、旋转、透明度、裁切全部是 p 的函数,没有独立计时器。

这意味着:

  • 用户滚动多快,效果就推进多快;
  • 停在中间,画面保持不变;
  • 反向滚动,动画严格倒放;
  • 不能劫持滚轮,也不能偷偷改变滚动速度。

固定画面时,用 position: sticky 把内容留在视口里,再让外层 section 多出一段高度,作为动画播放距离。

Stacked Cards:卡片自己叠成一座塔

层叠卡片适合 3–5 个并列、每个值得占一屏的内容,例如步骤、功能、方案或章节。

每张新卡从下方进入,覆盖上一张。旧卡逐渐缩小、变暗,只露出顶部约 16px 的边。

标准尺寸中,卡片约 936 × 720,圆角 28px,每张 sticky 位置比上一张低 16px。新卡到达时,旧卡按进度退缩:

1
2
scale = 1 - k × 0.05
darkness = k × 0.12

前三张叠起后,最深的一张约缩放到 0.85。最后一卡固定后,再保留约 320px 的阅读停顿,整组才一起离开。

卡片内部只放图片、名称和一句说明。文本应该限定在网格列内,绝不能因为名字太长而跑进图片。

Card Deck:顶部卡沿弧线飞走

卡组适合一次看一张的 3–6 个内容:精选、评价、亮点。

五张卡片先形成一叠。滚动开始后,最上面一张沿抛物线向左右交替飞出,下一张上升接替。

卡片 i 的飞出进度:

1
2
3
4
5
t = clamp(scrollProgress / 420 - i, 0, 1)

x = side × t² × 1000px
y = t × (160px × t - 40px)
rot = side × t × 16deg

旋转原点在卡片底部中心。抛物线先略向上抬,再向下落,比单纯水平滑出更像被甩走。

后面的卡片按深度向下偏移、缩小和变暗,最多露出三层。滚动回退时,已经飞走的卡片沿同一条路径回到原位。

Pinned Gallery:纵向滚动被翻译成横向移动

横向展廊适合 5–12 个超出屏幕宽度的项目:作品、产品、发布记录。

外层 section 的高度由横向总溢出决定,内部内容保持 sticky。页面纵向滚动多少,卡片行就向左移动多少:

1
2
p = (scrollY - start) / horizontalOverflow
translateX = -p × horizontalOverflow

这里不能加 easing。用户滚动 1px,卡片就横移对应比例;动作与手指方向不同,但仍然完全跟手。

展廊的固定距离最好控制在约三屏以内。项目更多时,应该使用可筛选的网格,而不是让用户滚很久才看到尽头。

Cover Flow:中间的封面最大,两侧收拢视线

Cover Flow 适合 5–9 个同形状内容:专辑、书、方案或人物。

每张封面占据一个步长。滚动进度先映射为连续的“中心索引” c,再计算每张卡片与中心的距离 d:

1
2
3
translateX = d × 260px
rotateY = clamp(d, -1, 1) × -30deg
scale = max(0.6, 1 - |d| × 0.2)

中心封面最大、正面朝前;两侧封面缩小并向外旋转,越远越暗。超过 3.5 个位置后隐藏,避免在视口外堆积无意义图层。

进度在相邻封面之间使用 smoothstep,让每张封面在中心停留短暂的一刻,而不是匀速滑过。

Image Expand:一张图片从窗口长成整个场景

图片展开适合一张足够强的图片或视频,用来开启下一段内容。

初始状态是标题与一个小图片窗口居中。滚动开始后:

  • 图片窗口通过 clip-path 向屏幕四周打开;
  • 圆角逐渐归零;
  • 图片自身从 1.2 缩回 1,看起来像最终画面被“展开”出来;
  • 标题更快淡出并上移。

标题、主画面、前景小字分别拥有不同缩放与位移速度,前后遮挡形成景深。主画面完全铺满后仍然固定,标题和前景字继续以不同速度上移。

下一段内容再从下方覆盖上来,顶部 28px 圆角在最后 120px 内压平,同时主画面压暗到约 35% 黑。

视频也可使用同样结构,但必须静音、循环,并只在屏幕内播放。

手机不是缩小版桌面

这些效果最容易在手机和短屏上坏掉。

固定区域必须使用 100svh,而不是 100vh。100vh 会把移动浏览器工具栏隐藏后的高度也算进去,内容因此钻到工具栏下方;dvh 又会随工具栏收放跳动,同样不适合固定内容。

只在加载、旋转和设备宽度变化时重新测量。高度变化小于约 120px 时忽略,那通常只是工具栏在显示或隐藏,重新计算会让卡片在滚动中突然跳位。

标准移动端策略:

效果 手机处理
Stacked Cards 保留,按视口缩放高度
Card Deck 保留,缩小卡组
Pinned Gallery 改为原生横向滚动与吸附点
Cover Flow 改为横向滑动的普通封面行
Image Expand 保留,按屏宽计算画框

视口高度低于 560px 时,不固定任何 section:退回列表、横向滚动行或全宽图片。

所有尺寸都需要随视口缩放。例如封面尺寸:

1
size = min(432px, 48svh, 70vw)

滚动距离本身也按视口高度缩放,并遵守安全区与固定顶栏高度。

排版也要服从滚动结构

这些效果很容易被过多内容毁掉。

每个 section 只保留一个短标题。卡片内部保持同一结构:图片、名称、一句说明。不要加标签、侧边说明、计数器或额外 caption。

长名称必须落在自己的网格列里,不能穿过图片。卡片通常不加阴影,用背景色与图片区分即可。强调色最多出现一次。

固定 section 中的条目仍然要能通过 Tab 到达,锚点链接要落在 section 起点,键盘滚动与滚轮行为一致。

实现时只保留一个滚动真相

Web 端优先使用:

  • position: sticky 做固定;
  • CSS scroll-driven animations(animation-timeline)描述可表达为关键帧的进度;
  • 对 Card Deck、Cover Flow 等需要逐卡计算的场景,用一个 passive scroll listener,每帧读取一次 scrollY,把进度写成 section 上的 CSS 自定义属性。

如果项目已有 GSAP ScrollTrigger 或 Motion,就沿用现有工具,不要为了一个 section 再引入第二套滚动库。

原生平台也可映射同一套进度:

  • iOS:scrollTransition / visualEffect、scrollGeometryChange;
  • Android:LazyListState + graphicsLayer;
  • Flutter:ScrollController + Transform / ClipRRect。

无论平台,都不能平滑劫持滚动。用户的手感必须保持原样,变化的只是内容如何响应。

减少动态效果时先恢复内容

开启减少动态效果时,最稳妥的回退是普通 section:列表、横向行、全宽图片。

也可以保留固定,但取消位移、旋转与缩放,只留下轻微透明度变化。不要保留大幅 3D 运动却声称“减少动态”。

检查清单

  • 每个效果是否由滚动进度直接驱动,而不是一次性触发;
  • 中途停下和反向滚动是否完全可逆;
  • 是否只动画 transform、opacity、clip-path、filter;
  • 固定距离是否合理,没有长时间锁住页面;
  • 手机是否使用 100svh,并处理工具栏收放;
  • 短屏是否取消固定,回退为列表、横滑或全宽图片;
  • 长标题是否在自己的文本列内换行;
  • 固定 section 中的内容是否可通过键盘到达;
  • 是否沿用了现有滚动库,没有引入滚动劫持;
  • 减少动态效果、200% 文本缩放、深浅模式和真实中端手机是否都验证过。

滚动卡片交互示例 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
Prompt

Rework a long page that already exists in my product so its cards move with scrolling. This changes my product, not a new page or a demo: keep my content, components, tokens and copy, find the sections that deserve it, and give each one of five scroll-driven card interactions: stacked cards (each new card covers the last, which shrinks and dims), a card deck (the top card flies off to one side and the next rises), a pinned gallery (the section holds still while scrolling moves a row sideways), a cover flow (the middle cover is largest; the others shrink, turn away and dim), or an image expand (a picture grows from a frame to the whole screen, with words behind and in front of it rising at different speeds for depth). The scroll position drives every effect, so the reader sets the pace and scrolling back plays it in reverse. It must hold up on every screen, phones above all, and at every viewport height (section 8).

Every value here is a recommendation. Sections 2 to 8 are a tested set (Standard); section 10 gives presets. I choose; you build what I choose.

First look at my product (section 0). Then ask me these one at a time, each as a short list of options with key values and the recommended one marked, and wait for my answer:
1. Which sections get which interaction (section 1): at most one of each per page, with ordinary sections between them.
2. Length: Short, Standard (recommended) or Long (section 10).
3. Phones and short screens: Standard (recommended: on phones the stack, deck and image expand stay, sized to the viewport; the gallery and cover flow become native horizontal rows with snap points; below 560px of viewport height nothing pins), the same as desktop, or plain sections on all phones. Tell me which screen sizes my analytics or audience suggest, if you can find out.
4. Reduced motion: plain sections (recommended: lists, horizontal rows, a full-width picture), or keep the pinning and drop the motion.
5. Engine: CSS scroll-driven animations with a small script as fallback (recommended), or the scroll library my project already uses. Never smooth-scrolling or scroll-hijacking.
Then sum up my choices in one table, propose how you will build it on my platform (section 9), with cost and fallback, and wait for my go-ahead.

0. Start from what exists
- The page: its sections in order, their content, cards, images and videos, and anything fixed or sticky (header, banner, cookie bar) with its height per breakpoint.
- For each section, which interaction fits and which sections must stay as they are (anything people scan, compare or search).
- How the layout responds today: breakpoints, how it sizes to the viewport (vh, svh, dvh, JS reading innerHeight), what already breaks on short screens.
- How the page scrolls: window or inner container, smooth-scroll libraries, anchor links, existing scroll effects.
- Platform and versions, tokens for radius and motion, dark mode. Tell me in a few lines before asking.

1. Which interaction for which content
- Stacked cards: 3 to 5 parallel items worth a screen each (steps, features, plans, chapters).
- Card deck: 3 to 6 items seen one at a time (picks, testimonials, highlights).
- Pinned gallery: 5 to 12 items wider than the screen, to browse (work, products, releases).
- Cover flow: 5 to 9 items of the same shape, one in focus (albums, books, plans, people).
- Image expand: one strong picture or video that opens the next chapter.

2. The rule behind all five
- Each section has one progress p = clamp((scrollY - start) / distance, 0, 1), and every property is a function of p, never a timed animation that scroll merely starts. Stopping halfway leaves it halfway; scrolling back reverses it exactly. Never change scroll speed, snap or catch the wheel.
- Pinning is position: sticky inside a section taller than the screen; the extra height is the distance the effect plays over.
- Animate only transform, opacity, clip-path and filter. Text stays in the page and readable at every p.
- When a section is pinned, show where the reader is as quietly as possible: a thin bar or dots, never a label.

3. Stacked cards (demo: 1000 x 896 viewport)
- Cards 936 x 720 (all 12 columns, bled 24px so their 24px padding puts content back on the columns), corners 28px, 48px apart.
- Each sticks 16px lower than the last: top = 40px + i * 16px (add a fixed header's height). Newer cards cover older ones, leaving a 16px strip of each.
- A card recedes as later ones arrive: k = clamp((scrollY - when it stuck) / 752px, 0, cards after it); scale = 1 - k * 0.05 from its top center (0.85 under three), dark layer at k * 0.12.
- Inside a card, the name and one line sit on columns 0 to 5 and wrap there, never into the picture; the name starts 48px below the card's top, the line 24px under it.
- Give each card its own muted tint and picture (demo: stone, sage, clay, then one ink card). No shadows.
- After the last card sticks, hold 320px, then the stack leaves together.
- Optional opening: the section's title sized to span the grid exactly (not cropped), the first card covering its foot; it moves at half the scroll and fades out over the 280px before the first card sticks.

4. Card deck
- Five cards in a pile, 432 x 456 (six columns, centred) under the title; each holds a picture 8px in, then a name and one line 24px in, nothing else.
- Section 100vh + 1920px, pinned: 420px of scrolling throws each of the first four cards, then a 240px hold. The last card stays.
- Card i: t = clamp((scrollY - start) / 420 - i, 0, 1). It flies to one side, alternating: x = side * t * t * 1000px, y = t * (160px * t - 40px), rotate = side * t * 16deg about its bottom center. Hidden once thrown; scrolling back returns it on the same path.
- Cards below sit 18px lower and 0.05 smaller per place, dark layer 0.04 per place, at most three deep, rising a place as the top card goes.

5. Pinned gallery
- 5 to 12 cards in a row: demo eight, 280 wide (four columns) and 24px apart, each a white card with its picture 8px in, then name and artist. Title above, 48px clear of the row; a 2px bar below (track 6% black, fill 30%).
- Section 100vh + overflow (row width minus viewport width, 1520px in the demo); content sticky at top 0, 100vh tall.
- p = (scrollY - start) / overflow; the row moves translateX(-p * overflow), no easing: scrolling turned sideways. It lets go at the last item.
- Keep the pinned distance under about three screens; more items belong in a grid.

6. Cover flow
- 5 to 9 square covers, 432 (six columns, centred), under the title, dots below, no text on the covers.
- Section 100vh + 320px per step, pinned. r = clamp((scrollY - start) / 320, 0, count - 1); c = floor(r) + smoothstep(fract(r)), so each cover rests in the middle a moment.
- For cover i, d = i - c: translateX = d * 260px, rotateY = clamp(d, -1, 1) * -30deg, scale = max(0.6, 1 - |d| * 0.2), dark layer min(|d|, 3) * 0.15, nearest on top. Perspective 1400px. Hide beyond 3.5 places. Dots light by 1 - |i - c|.

7. Image expand
- Section 100vh + 1200px, pinned: 900px to grow, 300px to hold.
- At the start the title and a 584 x 352 frame (columns 2 to 9, 48px below it) are centred together, corners 8px.
- The picture always covers the viewport; clip-path: inset() shows the frame and opens to 0 with no corners, while the picture settles from scale 1.2 to 1, so it reads as growing. Both on e = ease(p), cubic-bezier(0.45, 0, 0.25, 1). The title fades at twice the speed and rises 60px.
- Depth: cut the main shape out of the picture as its own layer (demo: the hills), set a title behind it with its foot hidden by the shape, and one small line in front. As it opens, each settles from its own scale (picture and shape 1.2, title 1.25, line 1.4). Once full, the picture and shape stay still while the title rises at 0.25 of the scroll and the line at 0.5. Something behind something, moving at another speed, reads as perspective.
- Then the next section slides over it with 28px top corners that flatten over its last 120px, while the picture darkens to 35% black. A video works the same, muted and looping, only while on screen.

8. Screens and viewport heights
The demo's sizes are for a 1000 x 896 viewport. Scale them to the screen; never a fixed height that assumes a tall window.
- Size pinned sections with 100svh, not 100vh: on phones 100vh is the height with the toolbar hidden, so content runs under the toolbar. Never dvh for pinned content; it jumps as the toolbar moves.
- Measure on load, on orientation change and when the width changes. Ignore height-only resizes under about 120px (the toolbar showing and hiding); recomputing then makes cards jump mid-scroll.
- Fit each pinned section into one screen:
- Stacked card height = min(720px, 100svh - sticky top - (cards - 1) * 16px - 32px); the distance between cards sticking follows it.
- Deck: title + 48px + card fit in 100svh - 64px; the picture gives up height first.
- Gallery card height = min(520px, 100svh - title - 48px - 96px).
- Cover size = min(432px, 48svh, 70vw); the spread scales with it.
- Image frame = min(584px, 100vw - 2 * margin) wide at 5:3; the insets follow from it.
- Scale every scroll distance by clamp(0.7, viewport height / 896, 1.2).
- Below 560px of height (a phone in landscape, a short window), nothing pins: lists, horizontal rows, a full-width picture.
- Type follows the width: section titles clamp(36px, 7vw, 64px), card names clamp(28px, 5vw, 36px).
- Full-bleed moments respect env(safe-area-inset-*). Subtract a fixed header from every fit and sticky top.

Layout and type (all sections)
- Lay everything on the column grid first. Every text box is as wide as its columns, so long names wrap instead of running into a picture.
- What a title introduces starts 48px below it; in a pinned section the title and content are centred in the viewport together; centred titles over centred content, left-aligned over left content.
- Keep the cards in focus: outside them one short title per section, no tags, side copy, counters or captions; inside them one structure: picture, name, one line.
- Two typefaces in four sizes (demo: Newsreader 64 and 36, Geist 18 and 16). Pull large serif lines left by their first letter's side bearing; above about 100px use a text optical size so serifs stay blunt.
- No dividers except between list rows, no drop shadows, the accent colour once at most. One picture style per group, and never the same picture twice on a page.
- Anchor links land at a section's start. Keyboard scrolling works like the wheel; items in pinned sections stay reachable with Tab.

Check
- Each section slow, fast and backwards: no jumps, flicker or gaps.
- Viewports 375x667, 390x844, 430x932 (toolbar shown and hidden), 844x390, 768x1024, 1280x720, 1440x900, 1920x1080, and a 600px-tall desktop window: nothing cut off, no card taller than the screen, nothing under a toolbar or fixed header.
- 200% text zoom, reduced motion, keyboard, light and dark; full frame rate on a mid-range phone; the values built match my table.

9. How to build it
Check these against my stack and versions.
- Web: position: sticky for pinning; scroll-driven animations (animation-timeline: view() or a named timeline, animation-range). Where unsupported, or where keyframes are not enough (the deck's per-card ranges, the cover flow's resting steps), one passive scroll listener reads scrollY once per frame, computes each section's p from offsets measured on resize, and writes it as a custom property on that section only.
- If the project already uses GSAP ScrollTrigger (scrub, pin) or Motion (useScroll, useTransform), use it with these values; never add one only for this.
- iOS (SwiftUI): .scrollTransition or .visualEffect on the view's frame in the scroll view (onScrollGeometryChange on iOS 18), scaleEffect, rotation3DEffect, offset, clipShape; gallery and cover flow as horizontal ScrollViews with .scrollTargetBehavior(.viewAligned).
- Android (Compose): LazyListState for p, Modifier.graphicsLayer for scale, rotationY, alpha, translation and clip; LazyRow with snapping or HorizontalPager.
- Flutter: CustomScrollView with slivers, a ScrollController for p, Transform and ClipRRect; PageView for gallery and cover flow.

10. Presets
- Length: Short (stack 560px, deck 300px, gallery 1.25px sideways per 1px, cover step 240px, picture 600 + 200px), Standard (752, 420, 1:1, 320, 900 + 300, recommended), Long (900, 560, 1:1 with 200px held at each end, 420, 1200 + 400).
- Stack depth: Flat (scale 0.03, shade 0.08 per card), Standard (0.05, 0.12), Deep (0.07, 0.16, 24px strips).
- Deck throw: Gentle (8deg, 700px, always right), Standard (16deg, 1000px, alternating), Lively (24deg, 1200px, 60px lift).
- Cover flow: Flat (no turn, sides at 0.85), Standard (30deg, 0.8), Deep (45deg, 0.75, 180px apart).
- Picture start: Small (420 x 280), Standard (584 x 352), Wide band (full width, 340 tall).

质感来自可解释的细节

滚动动效真正厉害的地方,不是把页面变得复杂,而是让滚动位置成为一个可读的时间轴。

卡片往哪里走、图片什么时候打开、两侧封面如何退后,全部由用户当前的位置决定。回滚可以重来,短屏可以退回普通内容。这样滚动才有惊喜,但不会夺走控制权。

站内搜索

没有找到内容!