✨ 景深环形卡片与流体渐变——《999 个小技巧,让你 Vibe 的产品更有质感》021 今天分享一组具有空间感的卡片效果。可以让你的卡片轮播更生动一些——带有景深、边缘扭曲与色散 Prompt 随附 ⬇️ ,可以直接抄,能获得与视频中同样的参数逻辑与滑块 实现这类效果,有以下几个要点: 1. 两种视角:卡片沿同一条弧线排开,改变曲率的正负即可在环内、环外之间切换,切换时整排卡片平滑弯曲。 2. 环内:透视 860px,两侧卡片更近、更大,向内包围,一屏可见五张。 3. 玻璃边:画面两侧各 160px,越靠外缘偏移越大,卡片边缘向外张开,并带有柔和的色散。 4. 环外:透视 1500px,正中清晰,两侧和后排逐渐模糊、淡化。 5. 流体与翻面:正面是缓慢流动的四色渐变;切到环外时,卡片从中间向两侧依次翻面,露出图片。 透视、玻璃边、色散、景深、流速和圆角都做成了滑块,默认值即视频中的效果,可以按需调整。 001–021 期均收录在主页 Highlights,栏目每日更新,期待你的推荐!🫶 非常感谢
枯白啃设计

图标设计师 / 设计工程师

Prompt(3/3) 7. Turning over, and motion - Switching to Outside turns every card over about its upright middle, one after another from the front card out: for the whole run flip going 0 to 1 over 1800ms with cubic-bezier(0.3, 0, 0.6, 1), each card's lag = min(|s| / (6 * step), 1) and its turn = PI * smoothstep(0, 1, flip * 1.55 - lag * 0.55). The front half ends showing pictures and the far half its gradients. Switching back turns them back. - Drag: the row follows the pointer one pixel for one pixel. On release it glides on with the release speed (target = offset - velocity * 260ms), snaps to the nearest card, and takes clamp(|distance| * 1.6, 420, 1100) ms with cubic-bezier(0.25, 0.6, 0.2, 1). Pressing a card brings it to the front in 760ms. - A hard flick, fast then slow (used to open Inside): 16 cards in 2800ms with cubic-bezier(0.4, 0, 0.12, 1). It picks up speed in a moment rather than jumping to full speed, so a loop that begins with it has no jolt. - Any new motion stops the one before it. Reduced motion: no flow, an instant switch, slides of 200ms at most. 8. The settings panel - One row per number: its name, a slider and its value with the unit. The rows change with the view. Moving a slider updates the picture at once and stops any demo animation. A reset puts every value back to its default. - Inside: Perspective 860px (600 to 1400), Glass rim 160px (0 to 240), Dispersion 25% (0 to 60), Flow 20% (0 to 60), Corner 32px (0 to 60). - Outside: Perspective 1500px (900 to 2400), Depth blur 14px (0 to 30), Far fade 50% (0 to 100), Flow 20%, Corner 32px. - Use my slider component if I have one; otherwise a plain range input with a filled track, an upright handle and a number box beside it. - Changing Flow adds to the flow's angle each frame instead of multiplying time, so the gradients never jump. 9. How to build it, by platform These are suggestions; check them against my stack and versions. - Web (as in the demo): WebGL 2, two passes. Each card is one strip of upright columns (96 across, plus one past each side for the margin) placed in the vertex shader; upright lines stay straight under the perspective, so a top and a bottom point per column are enough. The pictures go in one texture array with mipmaps. Draw the cards farthest first with premultiplied alpha into a texture, then the glass pass to the screen. Run one requestAnimationFrame loop; at 2x pixel density it holds 60 fps on a laptop. - iOS: Metal (MTKView) with the same two passes, or SwiftUI with a Metal [[stitchable]] layerEffect for the glass pass and visualEffect for the cards. - Android: OpenGL ES 3 or Vulkan; on API 33+ an AGSL RuntimeShader can draw the gradient and the glass pass in Compose. - Flutter: FragmentProgram shaders for the gradient and the glass pass, the cards in a CustomPainter with drawVertices. - If the platform has no GPU path: CSS 3D transforms can place the cards (preserve-3d, the same x, z and a), with CSS gradients standing in for the fluid; leave out the glass pass and use a few stepped blur layers per card instead of the per-pixel blur. 10. Check - Inside: the outer cards flare smoothly in the glass with a soft color fringe, no fold, no repeated card; five cards in view. - Outside: reads as a ring at eye level; the middle is sharp, the blur grows smoothly to the sides and the far side, with no shimmer while the ring turns and no hard edge on a steeply turned card. - The turn-over runs from the middle out; the pictures read the right way round; the far side shows gradients. - Every slider changes the picture at once, the values match section 8, and reset restores them. - 60 fps on a mid-range phone; reduced motion, light and dark pages, and keyboard use of the panel all checked.
登录并发表评论

评论 · 0