serializeInstructions()
属于@remotion/paths
包。从v3.3.40版本开始可用
接受一个Instruction
数组,并将其序列化为SVG路径字符串。
serialize-instructions.tstsx
import {serializeInstructions } from "@remotion/paths";constnewPath =serializeInstructions ([{type : "M",x : 10,y : 10,},{type : "L",x : 20,y : 20,},]); // M 10 10 L 20 20
serialize-instructions.tstsx
import {serializeInstructions } from "@remotion/paths";constnewPath =serializeInstructions ([{type : "M",x : 10,y : 10,},{type : "L",x : 20,y : 20,},]); // M 10 10 L 20 20
如果指令与Instruction
类型不匹配,此函数可能会抛出异常,但它不会明确检查无效输入。