reversePath()
属于@remotion/paths
包。
将路径反转,使结束和开始位置互换。
tsx
import {reversePath } from "@remotion/paths";constreversedPath =reversePath ("M 0 0 L 100 0");console .log (reversedPath ); // "L 100 0 M 0 0"
tsx
import {reversePath } from "@remotion/paths";constreversedPath =reversePath ("M 0 0 L 100 0");console .log (reversedPath ); // "L 100 0 M 0 0"
如果路径无效,该函数将抛出错误:
tsx
reversePath ("remotion"); // Error: Malformed path data: ...
tsx
reversePath ("remotion"); // Error: Malformed path data: ...
Credits
源代码主要来自于svg-path-reverse。