Skip to main content

scalePath()

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

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

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

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

参数

path

string

有效的 SVG 路径字符串。

xScale

number

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

yScale

number

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

参见