Skip to content

translate

ts
function Rect.translate(rect: Rect, amount: number): Rect

Translates (moves) the rectangle by the specified amount in both horizontal and vertical directions.

Example

ts
Rect.translate({ left: 10, top: 20, width: 100, height: 50 }, 15);
// { left: 25, top: 35, width: 100, height: 50 }
ts
pipe({ left: 10, top: 20, width: 100, height: 50 }, Rect.translate(15));
// { left: 25, top: 35, width: 100, height: 50 }