normalizePath()
属于 @remotion/paths 软件包的一部分.
🌐 Part of the @remotion/paths package.
从路径中删除所有相对坐标并将它们转换为绝对坐标。
🌐 Removes all relative coordinates from a path and converts them into absolute coordinates.
如果路径有效,则返回一个字符串:
🌐 Returns a string if the path is valid:
import { normalizePath } from "@remotion/paths";
const normalizedPath = normalizePath ("M 50 50 l 100 0");
console .log (normalizedPath ); // "M 50 50 L 150 50"如果路径无效,该函数将抛出异常:
🌐 The function will throw if the path is invalid:
normalizePath ("remotion"); // Error: Malformed path data: ...鸣谢
🌐 Credits
源代码主要来自 svg-path-reverse。
🌐 Source code stems mostly from svg-path-reverse.
另请参阅
🌐 See also