描边涂抹填充按钮
悬停时一笔粗描边沿锯齿轨迹画满药丸,线宽随进度变粗,移开原路收回。蜡笔版以斜向排线涂满,带纸纹颗粒。React Native 用 Skia,网页用 CanvasKit。
灵感来自 @hiteshxdev 在 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 "stroke-scribble-fill-button" to this project. The full source is attached at the end of this prompt. Put the files under components/stroke-scribble-fill-button/, 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月9日
- 许可证
- 无限商业项目
- 原始设计
- @hiteshxdev(X)
你是设计者吗? 请求我们修改或下架此作品.
CLI 与 MCP 服务器 即将推出
在终端添加作品,或让智能体自行获取。在此之前,用“复制提示词”也能做到。 文档
功能说明
一个带有深色文字的小药丸按钮。按下它,或用指针悬停时,左侧先出现一道细细的斜线,然后一串相连的锯齿线向右推进,线条逐渐变粗,直到药丸完全变成蓝色。松手时路径反向回放,线条重新变细;在填充中途松开则从当前进度反向。文字始终保持深色。第二种蜡笔风格变体用相互叠加、颜色更深的蜡质排线来填充,边缘粗糙,并带有纸张颗粒质感。
实现方式
两种外观都是 Skia 路径。普通版本是一条很长的锯齿路径,使用修剪终点,线宽都由同一个进度值决定。蜡笔版本叠加许多带种子的排线以及三道波浪形补笔,并添加离散路径效果来制造粗糙边缘,还用 SkSL 噪声着色器挖出纸张孔洞和蜡质纹路。Reanimated 通过定时缓动驱动进度,同一个核心文件为 CanvasKit 的网页预览生成几何数据。progress 属性可以固定填充状态,便于截图。
适用场景
- 营销页或作品集页面中的行动号召按钮
- 需要手绘选中状态的标签或选项卡
- 创意应用中标准实心按钮的趣味变体
依赖
@shopify/react-native-skiareact-native-reanimatedreact-native标签
按钮浅色品牌营销极简路径描绘按压反馈状态切换