Skip to main content

reversePath()

属于 @remotion/paths 软件包的一部分.

🌐 Part of the @remotion/paths package.

反转路径,以便起点和终点交换。

🌐 Reverses a path so the end and start are switched.

import { reversePath } from "@remotion/paths";

const reversedPath = reversePath("M 0 0 L 100 0");
console.log(reversedPath); // "L 100 0 M 0 0"

如果路径无效,该函数将抛出异常:

🌐 The function will throw if the path is invalid:

reversePath("remotion"); // Error: Malformed path data: ...

鸣谢

🌐 Credits

源代码主要来自 svg-path-reverse

🌐 Source code stems mostly from svg-path-reverse.

另请参阅

🌐 See also