@remotion/paths
一个提供用于处理 SVG 路径的实用函数的包。该包包含来自 svg-path-properties
, svg-path-reverse
, svgpath
, svg-path-bbox
, translate-svg-path
和 d3-interpolate-path
的代码,并具有以下改进:
- 函数式风格的 API
- 一流的 TypeScript 类型
- 带有示例的文档
- ESM 导入风格
该包没有依赖项,这意味着可以在不使用 Remotion 的情况下使用该包。
- npm
- pnpm
- yarn
bash
npm i @remotion/paths
bash
npm i @remotion/paths
bash
pnpm i @remotion/paths
bash
pnpm i @remotion/paths
bash
yarn add @remotion/paths
bash
yarn add @remotion/paths
函数
getLength()
Obtain length of an SVG path
getPointAtLength()
Get coordinates at a certain point of an SVG path
getTangentAtLength()
Gets tangents
x
and y
of a point which is on an SVG pathreversePath()
Switch direction of an SVG path
normalizePath()
Replace relative with absolute coordinates
interpolatePath()
Interpolates between two SVG paths
evolvePath()
Animate an SVG path
translatePath()
Translates the position of an path against X/Y coordinates
warpPath()
Remap the coordinates of a path
scalePath()
Grow or shrink the size of the path
getBoundingBox()
Get the bounding box of a SVG path
resetPath()
Translates an SVG path to
(0, 0)
extendViewBox()
Widen an SVG viewBox in all directions
getSubpaths()
Split SVG path into its parts
parsePath()
Parse a string into an array of instructions
serializeInstructions()
Turn an array of instructions into a SVG path
reduceInstructions()
Reduce the amount of instruction types
许可
MIT