✨ 五种经典的卡片滚动交互——《999 个小技巧,让你 Vibe 的产品更有质感》019 今天分享五种效果出众的卡片滚动交互,适用于产品官网和个人作品集。 另附一条 Prompt,可将你产品中已有的长页面改造成同类滚动效果,直接复制即可 ⬇️ 这类交互的特别之处在于:用户滚动页面时,预期看到的是元素的纵向位移;而这些效果把滚动转化为横向、旋转甚至不规则的运动,因此给人耳目一新的感觉。 Apple 是这方面的高手,其官网常配合序列帧,实现许多令人印象深刻的效果。 这几类效果的细节如下: 1. 层叠卡片(Stacked cards):卡片随滚动逐层叠加,下层卡片依次变暗、缩小,顶部各保留一小段露出,以体现前后层次。 2. 卡组飞出(Card deck):顶部卡片沿弧线向左右两侧依次飞出,轨迹模拟真实的抛物线。 3. 横向展廊(Pinned Gallery):页面暂时固定,纵向滚动转化为横向移动,呈现与滚动方向完全不同的运动。 4. 封面轮播(Cover flow):经典的 3D 封面轮播,每张封面依次移到中间,两侧封面略微倾斜,收拢视线,使焦点更加集中。 5. 图片展开(Image Expand):小图随滚动铺满屏幕;标题与背景前后遮挡,再加上移动速度的差异,形成景深。 此外,这五种效果都由滚动位置直接驱动:停在一半,效果就停在一半;往回滚动,效果随之倒放。
枯白啃设计

图标设计师 / 设计工程师

Prompt(3/3) 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).
登录并发表评论

评论 · 0