Skip to main content

scalePath()

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
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";

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

A valid SVG Path string.

xScale

number

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

yScale

number

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

See also