曲线描绘的对比趋势图
黑色曲线描向第 6 个月,空心圆点落后于线头,在终点追上并弹一下;红色对照曲线先下探再反弹,填充区域从左向右揭开,随后文字淡入。HTML 与 React Native SVG 共用 core。
灵感来自 @mobbin 在 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 "line-draw-comparison-trend-chart" to this project. The full source is attached at the end of this prompt. Put the files under components/line-draw-comparison-trend-chart/, 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
- 依赖
- Expo SDK 54+
- 权限
- Pro
- 更新于
- 2026年10月27日
- 许可证
- 无限商业项目
- 原始设计
- @mobbin(X)
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
轻量的引导卡片,比较六个月内两条体重趋势线。一个圆点沿着一条逐渐下降的黑线移动,在下坡段,线的端点会超前于圆点。红线与之并行绘制,黑线下方的灰色面积和红线下方淡粉色的面积从左到右逐步显露。终点圆点会略微变大后回落。标题、月份标签、徽章和两行正文以淡入的方式上升出现。HTML 预览中还提供回放控件和拖动进度条。
实现方式
没有使用图表库。共享 JavaScript 核心保存一条手工描绘的曲线,构建带弧长表的单调三次插值,并在任意时刻 t 输出截断线段和填充多边形的现成 SVG 路径字符串。React Native 组件只用 react-native-svg 渲染这些路径,由 requestAnimationFrame 时钟驱动。黑线、红线、圆点和填充边缘各自遵循独立的时间轨道,这正是让线头领先于圆点的原因。文字入场使用缓动的透明度加上短暂的向上位移。
适用场景
- 展示预测结果(如体重、储蓄或进度)的引导页面
- 前后对比或有无对比的比较图表
- 结果页中主图表的短时揭示动画
依赖
react-native-svgreact-native标签
AI 助手徽章奖章按钮卡片图表渐变健康健身浅色加载动画极简引导页路径描绘揭示弹簧错峰入场