Skip to main content

serializeInstructions()

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

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

接受一个Instruction数组并将其序列化为SVG路径字符串。

🌐 Takes an array of Instruction's and serializes it into an SVG path string.

serialize-instructions.ts
import { serializeInstructions } from "@remotion/paths"; const newPath = serializeInstructions([ { type: "M", x: 10, y: 10, }, { type: "L", x: 20, y: 20, }, ]); // M 10 10 L 20 20

如果指令与 Instruction 类型不匹配,此函数可能会抛出异常,但它不会明确检查无效输入。

🌐 This function may throw if the instructions don't match the Instruction type, but it does not explicitly check for invalid input.

另请参阅

🌐 See also