UI module

inset

procedureextensionexperimentalsince 0.31.0Source

rect shrunk by amount on every side.

Example↗
r := inset(.{ 0, 0, 100, 40 }, 10);
assert(r.x == 10 && r.w == 80 && r.h == 20);
inset :: (rect: Rect, amount: float) -> Rect

rect shrunk by amount on every side.

Parameters

rect: Rect
the rectangle to shrink.
amount: float
how far to move each edge in. The size stops at zero instead of going negative.

Returns

Example↗
r := inset(.{ 0, 0, 100, 40 }, 10);
assert(r.x == 10 && r.w == 80 && r.h == 20);

See also