reduceInstructions()
属于 @remotion/paths 包。从 v3.3.40 起可用
🌐 Part of the @remotion/paths package. Available from v3.3.40
接受一个 Instruction 数组,并减少其指令类型,使路径仅包含 M、L、C 和 Z 指令。
🌐 Takes an array of Instruction's and reduces the amount of instruction types them so the path only consists of M, L, C and Z instructions.
在 v4.0.168 之前的版本中,Q 指令被移除了。
在逆向逻辑中,该函数将消除所有 H、V、S、T、A、Q、m、l、h、v、c、s、q、t、a、q 和 z 指令。
🌐 In reverse logic, this function will eliminate all H, V, S, T, A, Q m, l, h, v, c, s, q, t, a, q and z instructions.
如果你想手动编辑路径并且想确保它尽可能简单,这会很有用。
🌐 This is useful if you want to manually edit a path and want to make sure it's as simple as possible.
请注意,这可能导致路径变长。
🌐 Note that this may result in a longer path.
import { reduceInstructions , ReducedInstruction } from "@remotion/paths";
const simplified : ReducedInstruction [] = reduceInstructions ([
{ type : "m", dx : 10, dy : 10 },
{ type : "h", dx : 100 },
]);
/*
[
{type: 'M', x: 10, y: 10},
{type: 'L', x: 110, y: 10},
]
*/ReducedInstruction 型
🌐 ReducedInstruction type
如果你想要一种只包含简化指令的类型,你可以导入 ReducedInstruction 类型。
🌐 If you want a type which includes only reduced instructions, you can import the ReducedInstruction type.
import { ReducedInstruction } from "@remotion/paths";另请参阅
🌐 See also