迷你播放器变贴纸
2 秒循环中,专辑页向上滚动,迷你播放器缩小消失,封面飞到 Tab 栏旁,从圆角方形变为圆形再变成波浪边贴纸,略带过冲。随后整个过程倒放。react-native-svg,共用 core。
灵感来自 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 "mini-player-sticker-morph" to this project. The full source is attached at the end of this prompt. Put the files under components/mini-player-sticker-morph/, 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 核心保存几何信息、按源帧记录的关键帧、一个以时间为参数的帧函数,以及贴纸的不规则轮廓路径。滚动距离和播放器尺寸通过 Catmull-Rom 插值从关键帧读取。React Native 组件用 react-native-svg 绘制页面、标签图标、波形和贴纸,并用渐变和 Image 显示封面,由 requestAnimationFrame 循环推进时间。界面中没有保留任何位图,全部由代码绘制。
适用场景
- 可以展开和收起、覆盖在滚动内容之上的正在播放迷你播放器
- 随容器收缩而改变形状的徽章或贴纸
- 播放器必须保持在标签栏上方可触达的音乐、播客或视频应用
依赖
react-native-svgreact-native标签
卡片深色展开收起飞入飞出图标播放器极简形变音乐音频滚动驱动弹簧状态切换标签栏