Rect¶
A value that represents a two-dimensional rectangle.
Description¶
Rect describes a rectangle on a 2D plane. It is constructed using two corners, either two Vector2 positions or four numbers:
local rect1 = Rect.new(Vector2.new(10, 10), Vector2.new(80, 80))
local rect2 = Rect.new(10, 10, 80, 80)
This data type is used in the ImageLabel.SliceCenter property which determines the center area of a scaled image.
Constructors¶
new Supported Returns a new Rect with zero Vector2 positions.
new Supported Returns a new Rect from the given Vector2 positions.
new Supported Returns a new Rect using the first and last two arguments as coordinates for corners.
Properties¶
Width Supported The width of the Rect.
Height Supported The height of the Rect.
Min Supported The coordinates of the top-left corner.
The coordinates of the top-left corner.
The top-left corner of the rectangle as a Vector2. When you
construct a Rect with two positions, this property returns the
component-wise minimum of those positions regardless of the order they
were passed in. Defaults to (0, 0) for a Rect created with no
arguments.
Max Supported The coordinates of the bottom-right corner.
The coordinates of the bottom-right corner.
The bottom-right corner of the rectangle as a Vector2. When you
construct a Rect with two positions, this property returns the
component-wise maximum of those positions regardless of the order they
were passed in. Defaults to (0, 0) for a Rect created with no
arguments.
Nova binding inventory¶
| Library | Members |
|---|---|
new |
Height, Max, Min, Width |
Roblox reference: Rect