箭头沿轨道滑动的转发图标
图标整体保持不动:两支箭头沿圆角矩形轨道滑动。按下时箭头略微后退并缩小;松手后沿轨道跑半圈,途中短暂闭合成环,颜色同时变绿。HTML 与 react-native-svg 共用一个 core。
灵感来自 @alexabraham 在 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 "repost-icon-sliding-arrows" to this project. The full source is attached at the end of this prompt. Put the files under components/repost-icon-sliding-arrows/, 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月16日
- 许可证
- 无限商业项目
- 原始设计
- @alexabraham(X)
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个双钩式转发图标,左侧箭头朝上,右侧箭头朝下,居中显示在黑色屏幕上。按下时图标缩小到约十分之九的大小,并逆时针倾斜约十度。松开后,它顺时针旋转约半圈,略微过冲,然后以阻尼摆动回到轻微倾斜的静止姿态。旋转过程中,描边颜色在白色与绿色之间切换。由于图形在半圈旋转后保持对称,看起来就像两个箭头彼此滑过。按压时长可配置。
实现方式
图标是 react-native-svg 中的一对描边路径,由直线段、四分之一圆弧和小箭头三角形构成。共享 JavaScript 核心根据按下和松开事件,计算每个时刻的缩放、角度和颜色:先是测量得到的旋转曲线,随后是弹簧式回稳。组件将其送入 SVG 分组的变换,由 requestAnimationFrame 循环驱动,并包裹在 Pressable 中。没有发光、阴影或模糊,也不使用 Reanimated。
适用场景
- 社交信息流中的转发、分享或切换控件
- 需要在点按后出现清晰变化的双状态操作图标,例如关注或收藏
- 内容应用工具栏按钮的微交互
依赖
react-native-svgreact-native标签
3D 旋转按钮深色图标极简按压反馈社交弹簧状态切换