错峰径向 FAB 菜单
松手后加号以过冲弹簧转成关闭图标,六个彩色图标从外圈顺时针每 50ms 一个飞入,由糊变清;关闭时无回弹、逆序飞出。Skia 与 CanvasKit 共用 core。
灵感来自 @nitishkmrk 在 X 上发布的设计由 Now In Code 从零重建
import { FAB } from "./components";
export function Example() {
const progress = useSharedValue(0);
…
export function Example() {
const progress = useSharedValue(0);
…
Agent 提示词
Add the Now In Code component "staggered-radial-fab-menu" to this project. The full source is attached at the end of this prompt. Put the files under components/staggered-radial-fab-menu/, 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、Web
- 依赖
- Expo SDK 54+
- 权限
- Pro
- 更新于
- 2026年10月23日
- 许可证
- 无限商业项目
- 原始设计
- @nitishkmrk(X)
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
黑色舞台中央有一个白色加号按钮。按下时按钮稍微变暗并放大,松手后打开菜单。加号旋转为叉号,同时六个彩色圆形从环外飞入并落在六边形的六个角上,每个圆形带有邮件、照片、通知、消息、日历和编辑图标。它们按顺时针顺序依次到达,略微过冲,落定时淡入并去除模糊。关闭时它们按相反顺序向外飞出,同时模糊并淡出,叉号转回加号。动画中途反向时,会保留当前速度。
实现方式
共享的 JavaScript 核心为每个圆形运行一个弹簧,使用 RK4 在小步长内积分,并记录每个圆形的延迟开始时间,使错开效果在中途反转时仍然连续。React Native 组件将七个圆盘绘制到一个 Skia 画布中,每个彩色圆形对应一个分组,包含平移、缩放以及可选的模糊层,requestAnimationFrame 循环在所有元素静止时停止。点击区域为透明的 Pressable。画布会超出其布局框,因此父容器需要可见的 overflow。
适用场景
- 提供少量快捷操作的浮动操作按钮
- 社交或笔记应用中的新建或分享菜单
- 研究在中途被打断时仍保持连续的错开弹簧动画
依赖
@shopify/react-native-skiareact-native标签
按钮深色设计工具展开收起渐变图标菜单极简形变按压反馈社交弹簧错峰入场系统界面