折射玻璃透镜卡片轮播
圆角照片卡下方是同图的模糊放大背景。横向拖动时,卡片被一块比屏幕还大的椭圆透镜折射:越靠边放大越强,12 次采样拉出色散,松手弹簧吸附到相邻卡并无限循环。网页端用 WebGL。
灵感来自 @rit3zh 在 X 上发布的设计由 Now In Code 从零重建
import { Piece } from "./components";
export function Example() {
const progress = useSharedValue(0);
…
export function Example() {
const progress = useSharedValue(0);
…
Agent 提示词
Add the Now In Code component "refractive-glass-lens-card-carousel" to this project. The full source is attached at the end of this prompt. Put the files under components/refractive-glass-lens-card-carousel/, install the listed dependencies with `npx expo install`, and render it on a route I can open. Keep the timing and easing values documented in the source comments. Replace the sample copy and artwork with content from my app, or leave placeholders and list what I still need to supply. === Source files are attached here for paid plans ===
Pro 作品。提示词包含完整源码。开始使用
详情
- 平台
- iOS、Android
- 依赖
- Expo SDK 54+
- 权限
- Pro
- 更新于
- 2026年11月2日
- 许可证
- 无限商业项目
- 原始设计
- @rit3zh(X)
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个深色的活动邀请函界面,中央有一张大的圆角卡片,两侧露出相邻卡片的边缘。左右拖动时,整个卡片舞台会穿过一个比屏幕还大的椭圆形玻璃透镜。越靠近边缘放大率越大,使卡片轮廓向内弯曲,透镜会把彩虹色的边缘拉到轮廓线和文字上。卡片会随滚动速度最多缩小四分之一。松手时,轮播会按位置或甩动速度吸附到最近的卡片,并无限循环。页面背景是当前卡片照片经过压暗、放大后的模糊版本,随滑动交叉淡入淡出;卡片停稳后,透镜会在其上清除。
实现方式
透镜是一个 SkSL 运行时着色器,作用于承载卡片舞台的 Skia 图层组,并带有 12 次采样的色散分离。卡片变换、图片和着色器 uniform 来自 Reanimated 派生值,由帧回调驱动演示回放或实时引擎。卡片正面的模糊由视图快照(makeImageFromView)生成,并在两个离屏通道中模糊。手势处理器 Pan 报告甩动所用的速度。原生玻璃按钮来自 expo-glass-effect,卡片文字的淡出使用线性渐变。
适用场景
- 社交应用中的活动、票务或邀请函轮播
- 需要拖动和甩动有物理感的精选项目选择器
- 在任何内容舞台(不限于卡片)上叠加折射层
依赖
@shopify/react-native-skiaexpo-glass-effectexpo-linear-gradientreact-native-gesture-handlerreact-native-reanimatedreact-native-svgreact-native标签
头像徽章奖章模糊过渡按钮卡片轮播色散交叉淡化深色拖拽活动邀请流体渐变首页液态玻璃形变导航栏社交弹簧滑动手势系统界面