Skip to main content

scalePath()

属于 @remotion/paths 包。从 v3.3.43 版本起可用

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

允许你增大或缩路径径的大小。

🌐 Allows you to grow or shrink the size of a path.

scale-path.ts
import { scalePath } from "@remotion/paths"; const newPath = scalePath("M 0 0 L 100 100", 1, 2); // "M 0 0 L 100 200";

变换的原点是路径的左上角。要使用不同的原点,首先使用 translatePath() 将路径移动到所需的原点,然后进行缩放,最后再移回原始原点。

🌐 The origin of the transform is the top left corner of the path. To use a different origin, first use translatePath() to move the path to the desired origin, then scale it, and finally move it back to the original origin.

参数

🌐 Arguments

path

string

有效的 SVG 路径字符串。

🌐 A valid SVG Path string.

xScale

number

用于水平缩放路径的因子。1 将保持路径不变。

🌐 The factor of which to scale the path horizontally. 1 will leave the path unchanged.

yScale

number

用于垂直缩放路径的因子。1 将保持路径不变。

🌐 The factor of which to scale the path vertically. 1 will leave the path unchanged.

另请参阅

🌐 See also