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

图标设计师 / 设计工程师

Prompt(1/3) Prompt Build a ring of cards in my project, in two views. Inside: the viewer stands in the middle of the ring, the cards near the edges come closer and grow, and they pass under a rim of glass at each side of the frame that bends them and splits their colors. Outside: the ring is seen at eye level from outside, the front card is in focus, the sides and the far side soften with distance, and switching to it turns the cards over, one after another, from flowing gradients to pictures. Every card's gradient flows slowly. A settings panel shows the key numbers as sliders, set to the defaults below, so they can be tuned live. Every value here comes from a working demo and is the default, not a requirement. Build it with these values first, then let me tune them with the panel (section 8). Before building, look at my project (section 0) and ask me these, one at a time, with the recommended answer marked: 1. Where it goes: its own page or section (recommended), or a component I name. 2. What the cards hold: flowing gradients on the front and my pictures on the back (recommended; tell me where the pictures come from), gradients only, or pictures only (then skip the turn-over and show the pictures in both views). 3. The view it opens in: Inside (recommended) or Outside, and whether people can switch (a two-option segmented control, recommended). 4. The settings panel: shown to everyone, shown only in development, or hidden behind a toggle. Then sum up my answers, say how you will build it on my platform (section 9), and wait for my go-ahead. 0. Start from what exists - Find how the project draws (DOM, canvas or WebGL, a native view tree, a GPU renderer), its framework and versions, where the pictures live, its slider or form components, and whether it has a dark mode and a reduced-motion setting. - Tell me in a few lines what you found before asking. 1. The ring - N cards of w x h, a gap between them, one step = w + gap apart along an arc. Default: N = 22, 180 x 300, gap 18, so step 198 and radius R = N * step / (2 * PI) ≈ 693. The ring's circumference is exactly the row, so it closes on itself. - Each card i sits at s = wrap(i * step - offset) along the arc, wrapped into [-N * step / 2, N * step / 2). offset is how far the row has moved; the front card is round(offset / step) mod N. - One signed curvature c = bend / R places every card: for c = 0, x = s, z = 0, a = 0; otherwise a = s * c, x = sin(a) / c, z = (1 - cos(a)) / c. x runs across, z toward the viewer, and the card turns by a about its upright middle. bend = 1 is Inside (the ring curves toward the viewer), bend = -1 is Outside. - Switching views eases bend from one to the other over 1100ms with cubic-bezier(0.65, 0, 0.35, 1), so the row visibly bends from one ring into the other. 2. The camera - Perspective P is the eye's distance from the front card: P = mix(pIn, pOut, (1 - bend) / 2), so it moves with the switch. Defaults: pIn 860 (a little behind the ring's center, so the row curves without pulling the side cards too far; at P = R the eye is exactly at the center), pOut 1500 (well back, so the ring turns away gently). - The eye looks straight on, at the cards' middle height. A point (x, y, z) lands on screen at x * P / (P - z), y * P / (P - z), from the frame's center. - Leave out a card when any part of it is less than 140 units in front of the eye, or when it is wholly off the frame. - Inside, the 22-card ring at pIn 860 shows five cards: three whole, the outer two going into the glass. Outside it shows the whole ring, the far side between and beyond the near cards. 3. The card face - Corners: a continuous curve, a superellipse of exponent 4 over a 32px radius, the same curve as CSS corner-shape: superellipse(2). In a shader, the distance to the outline is: d = abs(p) - (w, h) / 2 + r; m = max(d, 0); dist = (m.x^4 + m.y^4)^(1/4) + min(max(d.x, d.y), 0) - r. - Front: a flowing gradient of four colors (section 4). Back: a picture, shown mirrored so it reads the right way round when the card is turned. - No shadow, no reflection, no darkening as cards turn away: on a white page they only look dirty. Depth comes from size, blur and fade (section 6). - Pressing a card shrinks it to 0.95 in 140ms and back in 320ms, about its middle.
登录并发表评论

评论 · 0