边缘收窄的卡片滚动与浮动 Tab 栏
任务界面有六张大照片卡和七张小卡,按录制的 16 秒循环滚动。卡片靠近顶部和底部时每侧最多收窄 10px,并经柔和遮罩淡出,固定的玻璃 Tab 栏浮在其上。纯 React Native 视图,共用 core。
灵感来自 X 上的一条帖子由 Now In Code 从零重建
import { Tab } from "./components";
export function Example() {
const progress = useSharedValue(0);
…
export function Example() {
const progress = useSharedValue(0);
…
Agent 提示词
Add the Now In Code component "edge-narrowing-card-scroll-tab-bar" to this project. The full source is attached at the end of this prompt. Put the files under components/edge-narrowing-card-scroll-tab-bar/, 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 作品。提示词包含完整源码。开始使用
详情
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个浅色主题的滚动页面,上面是大幅照片卡片和衬线标题,之后是一串较小的缩略图卡片。每张卡片接近屏幕顶部或底部边缘时,两侧会略微收窄,每侧最多约 10 个源像素,其内容在边缘附近的柔和遮罩下淡出,因此列表看起来像是在远离观众的方向卷曲。底部是药丸形标签栏,带有选中的胶囊和一个独立的圆形按钮。滚动时播放的是预先编排好的一串轻甩和停止,包括快速甩动和接住的动作,而不只是跟随手指。
实现方式
共享的纯模块保存卡片布局、逐帧与参考拟合的滚动表、边缘收窄函数和淡出遮罩。React Native 组件只渲染 View、Text 和 Image,按请求的宽度缩放,并在 requestAnimationFrame 循环中推进滚动表,还提供冻结时间选项。照片是内置的替代图像,上面叠加实时文字。衬线标题字体由宿主应用加载。没有原生模块,也没有动画库。
适用场景
- 卡片需要边缘景深提示的长篇编辑或发现列表
- 先是大卡片、之后是紧凑列表的首页信息流
- 无需手势库的滚动联动效果
依赖
react-native标签
按钮卡片渐变首页浅色极简视差习惯效率滚动驱动状态切换标签栏