形变式下拉刷新指示器
回放的下拉手势让信息流下滑,头部下方展开渐变横幅。圆环弧随下拉距离扫过,脸的嘴巴从一个点长成笑容,随后笑容变形为对勾,横幅收起。纯 React Native 视图。
灵感来自 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 "morphing-pull-to-refresh-indicator" to this project. The full source is attached at the end of this prompt. Put the files under components/morphing-pull-to-refresh-indicator/, 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 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个深色的信息流页面,有页眉、一张问题卡片、一张睡眠卡片和底部标签栏。向下拖动内容时,上方会拉出一条横幅,整个页面随横幅一起下移。横幅内的一个圆形图标跟随拖动,展开时会略微下沉。首先出现一圈暗淡的环形轨道,随后当拖动达到阈值时,一道明亮的弧线从十二点方向顺时针扫过,直到绘成完整的圆,同时一个嘴巴从一个点长成笑脸。松手后,横幅保持固定高度,笑脸变形为对勾,并伴随一个短暂的拖影;内容稳定后,横幅滑回关闭。这个循环会不断重复。
实现方式
共享的纯 JavaScript 模块把时间转换为横幅高度、图标位置、圆环扫过的进度,以及笑脸变为对勾所需的形状点。拖动、释放和关闭的曲线保存为实测的关键帧表;圆环和嘴巴由下拉距离驱动,而不是由时间驱动。组件只使用 React Native 的视图和 Image,图标是用代码绘制的 SVG 栅格化成的 PNG,由 requestAnimationFrame 循环推进。提供冻结时间的属性用于测试。导入中没有手势或动画库。
适用场景
- 信息流或收件箱中的自定义下拉刷新头部
- 进度与拖动距离相关联的加载指示器
- 将一个图标平滑变形为另一个图标的成功确认
依赖
react-native标签
头像按钮卡片深色渐变健康健身图标列表加载动画极简形变习惯效率社交弹簧状态切换标签页