curve-arrow

April 29, 2026 · View on GitHub

用纯 TypeScript 生成 SVG <path>d 字符串:沿三次 Bézier 加宽的箭柄 + 三角箭头头部,闭合路径。零运行时依赖

buildCurvedArrowPathD 用法说明

import { buildCurvedArrowPathD } from 'curve-arrow'

const d = buildCurvedArrowPathD({ x: 100, y: 200 }, { x: 400, y: 300 })
// <path d={d} fill="currentColor" />
参数面板文案范围
bendStrength弯曲0~10
bendArch朝向(向上 / 向下)'up' / 'down'
handleScaleXX 轴缩放0.2~1.5
handleScaleYY 轴缩放0.2~1.5
segments细分1~160
startWidth起点宽度4~96
endWidth终点宽度4~96
startClearance起点偏移0~120
tipClearance终点偏移0~120
arrowBaseExtraPx箭头宽度0~64
arrowTipScale箭头长度1~2.5

许可证

MIT