@remotion/paths
一个提供处理 SVG 路径的实用函数的包。该包包括来自 svg-path-properties、svg-path-reverse、svgpath、svg-path-bbox、translate-svg-path 和 d3-interpolate-path 的代码,并具有以下改进:
🌐 A package providing utility functions for dealing with SVG paths. This package includes code from svg-path-properties, svg-path-reverse, svgpath, svg-path-bbox, translate-svg-path and d3-interpolate-path with the following improvements:
- 函数式风格 API
- 一流的 Typescript 类型
- 带示例的文档
- ESM 导入风格
此软件包没有依赖,这意味着此软件包可以在没有 Remotion 的情况下使用。
🌐 This package has no dependencies, meaning this package can be used without Remotion.
- npm
- pnpm
- yarn
npm i @remotion/pathspnpm i @remotion/pathsyarn add @remotion/paths函数
🌐 Functions
getLength()
Obtain length of an SVG path
cutPath()
Cut an SVG path at a specified length
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
许可证
🌐 License
MIT