Skip to main content

getSubpaths()

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

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

获取一个 SVG 路径并返回一个子路径数组。

🌐 Takes an SVG path and returns an array of subpaths.

路径中的每个 Mm 语句都会创建一个新的子路径。

🌐 Each M and m statement in a path creates a new subpath.

有两条直线的路径示例:

🌐 Example of a path that has two straight lines:

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

const parts = getSubpaths(`
  M 0 0 L 100 0
  M 0 100 L 200 100
`);

返回一个包含两部分的数组。

🌐 An array is returned containing two parts.


console.log(parts[0]); // "M 0 0 L 100 0"
console.log(parts[1]); // "M 0 100 L 200 100"

包含相对 m 元素的路径将被转换为 M 元素。

🌐 Paths containing relative m elements will be converted into M elements.

另请参阅

🌐 See also