Skip to main content

resetPath()

属于 @remotion/paths 包。从 v3.3.40 起可用

🌐 Part of the @remotion/paths package. Available from v3.3.40

将 SVG 路径平移,使其边界框的左上角位于 0, 0。在转换 SVG 路径坐标时,这对于简化计算非常有用。

🌐 Translates an SVG path so that the top-left corner of the bounding box is at 0, 0. Useful for simplifying the math when transforming the coordinates of an SVG path.

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

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

🌐 This function will throw if the SVG path is invalid.

另请参阅

🌐 See also