Skip to main content

resetPath()

属于@remotion/paths包。从v3.3.40版本开始可用

将SVG路径转换,使得bounding box的左上角位于0, 0。在转换SVG路径的坐标时,简化数学运算时非常有用。

reset-path.ts
tsx
import { resetPath } from "@remotion/paths";
 
const newPath = resetPath("M 10 10 L 20 20"); // M 0 0 L 10 10
reset-path.ts
tsx
import { resetPath } from "@remotion/paths";
 
const newPath = resetPath("M 10 10 L 20 20"); // M 0 0 L 10 10

如果SVG路径无效,此函数将抛出异常。

另请参阅