Skip to content

centerX

ts
function Rect.centerX(rect: Rect): number

Gets the horizontal center x-coordinate of a rectangle.

Example

ts
Rect.centerX({ left: 10, top: 20, width: 100, height: 50 });
// 60
ts
pipe({ left: 10, top: 20, width: 100, height: 50 }, Rect.centerX());
// 60