✨ 会倾斜、能翻转的 3D 镭射卡片——《999 个小技巧,让你 Vibe 的产品更有质感》018 今天分享六种镭射卡片的材质预设:Prism、Rainbow、Pearl、Sparkle、Chrome 和 Etched,适用于门票、分享卡片、购买凭据等场景。 另附一条 Prompt,可将你产品中的卡片改造为同类效果,直接复制即可 ⬇️ 实现这类效果,有以下几个要点: 1. 倾斜:卡片随指针方向倾斜,最大角度为 12°,指针离开时轻微回弹;无人操作时,卡片保持轻微晃动。 2. 镭射层:叠加在卡片底色之上,越靠近光点,亮度越高。 3. 高光与亮边:高光以光点为中心向外扩散;亮边仅在靠近光点的一段被照亮,若隐若现。 4. 视差层次:窗口内的元素分布在不同深度,卡片转动时各层相对错开,呈现真实的三维空间感。 5. 厚度:点击卡片可翻转至背面,翻转时卡片略微抬起,露出 10px 的厚度。
枯白啃设计

图标设计师 / 设计工程师

Prompt(4/5) - Reduced motion: no tilt, no sway and no flip animation (the flip becomes an instant swap or a 200ms cross-fade); the light may still follow the pointer; the background stands still. - The card keeps its role: a link or button stays one, the back is reachable by keyboard and announced, and nothing important is only visible at one angle. 7. The background (only if chosen) - A glow behind the card: radial-gradient(closest-side, hsl(<finish's hue> 85% 64% / 0.3), transparent), 860px across, its opacity (0.04 + 0.12 * on) / 0.3. - A slow fluid behind it: value noise in fBm (4 octaves, each turned by the matrix (1.6, 1.2; -1.2, 1.6), amplitude halving), warped twice: p = position / height * 1.25 + flow; q = (fbm(p), fbm(p + (5.2, 1.3) - flow.yx)); r = (fbm(p + 3.5q + (1.7, 9.2) + 1.3 * flow), fbm(p + 3.5q + (8.3, 2.8) - flow)); f = fbm(p + 3r). Color = mix(a, b, clamp(2.4f²)), then mix toward c by clamp(0.95 * |q| - 0.35), times 0.5 + 1.1f². Fade to the page color with smoothstep(0.82, 0.18, distance from (50%, 56%), y stretched 1.2). The flow moves round a circle of radius 0.33 about once every 40s; shift the field by (-rotateY, rotateX) * 0.008 so it answers the tilt. - Palettes (a, b, c): Prism rgb(10 20 80), rgb(58 42 156), rgb(26 108 192); Rainbow rgb(44 12 64), rgb(12 68 80), rgb(90 32 52); Pearl rgb(51 40 94), rgb(28 74 74), rgb(92 44 80); Sparkle rgb(12 20 56), rgb(38 51 122), rgb(74 58 22); Chrome rgb(24 28 36), rgb(44 54 70), rgb(22 64 74); Etched rgb(13 15 18), rgb(26 36 40), rgb(38 42 50). Ease between palettes over about a second. - Draw it at a third of its size, 30 times a second, and scale it up; it is soft, so nobody can tell. 8. How to build it, by platform These are suggestions; check them against my stack and its versions, and choose what fits. - Web (as in the demo): CSS 3D transforms with the layers as stacked elements and mix-blend-mode. Set the tilt as a transform on the card itself and the light as custom properties on the face only, never as inherited variables on a parent: changing a variable restyles everything under it. Move the glare as a 2x-sized layer with a transform, put the foil and the animated artwork on their own layers (will-change: transform), draw only the face that shows, and skip writes when a value has not changed. Drive everything from one requestAnimationFrame loop; the fluid is a small WebGL canvas. - iOS (SwiftUI): rotation3DEffect with a perspective, the layers as overlays with .blendMode(.colorDodge / .overlay / .multiply), gradients positioned from the light, spring animations for tilt and flip; DragGesture for touch and CoreMotion (CMMotionManager deviceMotion) for phone tilt. A Metal [[stitchable]] colorEffect can draw the foil in one pass. - Android (Compose): Modifier.graphicsLayer { rotationX; rotationY; cameraDistance = 12 * density }, Brush gradients drawn with BlendMode in drawWithContent, Animatable springs, pointerInput for drag, SensorManager (TYPE_GAME_ROTATION_VECTOR) for phone tilt. On API 33+, an AGSL RuntimeShader can draw the foil. - Flutter: Transform with Matrix4.identity()..setEntry(3, 2, 0.0006)..rotateX()..rotateY(), the layers in a Stack with ShaderMask or CustomPainter blend modes, a FragmentProgram for the foil and the fluid, sensors_plus for phone tilt. - Rust (wgpu, Bevy, egui): draw the card as one quad with a fragment shader that computes the foil, glare and rim from the light uniform, and transform it in 3D; the flip and edge are a second quad and a thin box. 9. Presets (around the Standard values; offer these when asking) - Feel: Quiet: tilt 6deg, spring 120 / 18 (no visible overshoot), sway at half (about 1 to 1.5deg), hover strength capped at 0.7. Standard (recommended): tilt 12deg, spring 140 / 15, sway 2 to 3deg (section 1). Lively: tilt 16deg, spring 180 / 12 (a clear bounce), sway 3 to 4deg. - Thickness: Thin 6px (6 layers), Standard 10px (10 layers, recommended), Thick 16px (16 layers); lift 30, 40 or 56px. - Flip spring: Soft 55 / 9 (slower, more overshoot), Standard 70 / 11 (recommended), Crisp 110 / 18 (fast, no overshoot). - Depth: None; Subtle (every depth halved); Standard (section 5, recommended). - Pearl-like restraint for everyday products: Pearl with Quiet; Rainbow and Sparkle with Standard or Lively for moments worth celebrating. 10. Check
登录并发表评论

评论 · 0