Rect¶
Global · Rect · server and client scripts
Rect creates a 2D rectangle from the pixel positions of two corners. For four-edge UI offsets such as Margins, SliceCenter, and CornerRadii, see Insets. To read a rectangle, see Rect.
new¶
Rect.new creates a rectangle from minX, minY, maxX and maxY.
Example
-- Client script: a panel with rounded top corners only.
local hud = World.Spawn({ UIRoot = true })
hud.Parent = World.Viewport.Screen
local radii = Rect.new(16, 16, 0, 0)
local panel = World.Spawn({
Box = { Size = UIVector.fromPoints(300, 200) },
Panel = {},
UICornerRadii = {
CornerRadii = Insets.new(radii.Min.X, radii.Min.Y, radii.Max.X, radii.Max.Y),
},
})
panel.Parent = hud