Hand-written by Joseph San Nicolas, Roblox Developer
Rect
Constructors
| Name | Description |
| new() | Creates a new Rect with both Min and Max set to Vector2.new(0, 0). |
| new(min: Vector2,max: Vector2) | Constructs a Rect from two Vector2 corners. The constructor takes the component-wise minimum of min and max as the top-left corner (Min) and the component-wise maximum as the bottom-right corner (Max). |
| new(minX: number,minY: number,maxX: number,maxY: number) | Constructs a Rect from four numbers representing the top-left corner (minX, minY) and the bottom-right corner (maxX, maxY). |
Code Snippet
local Image = Instance.new("ImageLabel")
Image.Image = "rbxassetid://0000000000"
Image.ScaleType = Enum.ScaleType.Slice
-- Define a 9-slice border using a Rect
Image.SliceCenter = Rect.new(10, 10, 118, 118)
Properties
| Name | Type | Description |
| Min | Vector2 | The top-left corner of the rectangle, as the component-wise minimum of the two constructor corners. |
| Max | Vector2 | The bottom-right corner of the rectangle, as the component-wise maximum of the two constructor corners. |
| Width | number | The horizontal span of the rectangle, equal to Max.X - Min.X. Always non-negative. |
| Height | number | The vertical span of the rectangle, equal to Max.Y - Min.Y. Always non-negative. |