UDim2

Afficher les obsolètes

The UDim2 data type represents a two-dimensional value where each dimension is composed of a relative scale and an absolute offset. It is a combination of two UDim representing the X and Y dimensions. The most common usages of UDim2 objects are setting the Size and Position of GuiObjects.


local guiObject = script.Parent
guiObject.Size = UDim2.new(0, 300, 1, 0) -- 300 pixels wide; full height of parent
guiObject.Position = UDim2.new(0, 50, 0, 0) -- 50 pixels from the left

Math Operations

The following math operations are valid for the UDim2 data type:

OperationDescription
UDim2 + UDim2Produces a UDim2 with components that are the sum of the respective components of the two UDim2 objects.
UDim2 - UDim2Produces a UDim2 with components that are the difference of the respective components of the two UDim2 objects.

Résumé

Constructeurs

Propriétés

Méthodes

Constructeurs

new

new

Paramètres

xScale: number
Valeur par défaut : 0
xOffset: number
Valeur par défaut : 0
yScale: number
Valeur par défaut : 0
yOffset: number
Valeur par défaut : 0

new

Paramètres

x: UDim
y: UDim

fromScale

Paramètres

xScale: number
Valeur par défaut : 0
yScale: number
Valeur par défaut : 0

fromOffset

Paramètres

xOffset: number
Valeur par défaut : 0
yOffset: number
Valeur par défaut : 0

Propriétés

The X dimension scale and offset of the UDim2.

The Y dimension scale and offset of the UDim2.

Width

The X dimension scale and offset of the UDim2.

Height

The Y dimension scale and offset of the UDim2.

Méthodes

Lerp

Returns a UDim2 interpolated linearly between this UDim2 and the given goal. The alpha value should be a number between 0 and 1.

Paramètres

goal: UDim2
alpha: number

Retours

Opérations Maths