UDim¶
Represents a one-dimensional value with two components, a relative scale and an absolute offset.
Description¶
The UDim data type represents a one-dimensional value with two
components: a relative scale and an absolute offset in logical pixels. At
evaluation time, the engine computes the final pixel value as
Scale * referenceMeasurement + Offset, where the reference measurement is
typically the size of a parent GuiObject along the corresponding axis.
UDim values appear individually in properties such as UICorner.CornerRadius, UIPadding.PaddingTop, and UIStroke.Thickness, or paired as a UDim2 for two-dimensional sizing and positioning.
Constructors¶
new Supported Returns a UDim from the given components.
Properties¶
Scale Supported The relative scale component of the UDim.
The relative scale component of the UDim.
The relative scale component of the UDim, expressed as a
fraction of a reference measurement (typically the corresponding axis of a
parent GuiObject). A value of 1 represents the full reference
measurement, 0.5 represents half, and 0 means the scale contributes
nothing to the resolved pixel value. Defaults to 0 when not specified in
the constructor. This property is read-only.
Offset Supported The absolute offset component of the UDim.
The absolute offset component of the UDim.
The absolute offset component of the UDim in pixels. This value
is added to the resolved scale portion (Scale * referenceMeasurement) to
produce the final pixel measurement. The offset is stored as an integer.
Defaults to 0 when not specified in the constructor. This property is
read-only.
Math operations¶
+ Check Produces a UDim representing the sum of the two UDim values.
- Check Produces a UDim representing the difference between the two UDim values.
Produces a UDim representing the difference between the two UDim values.
Produces a UDim whose Scale is the difference of the two
operands' scales and whose Offset is the difference of their offsets.
Each component is subtracted independently:
UDim.new(a.Scale - b.Scale, a.Offset - b.Offset).
Nova binding inventory¶
| Library | Members |
|---|---|
new |
Offset, Scale |
Roblox reference: UDim