UDim2

顯示已棄用項目

*此內容很快就會推出您所選的語言版本。

The UDim2 data type represents a two-dimensional value where each dimension is composed of a relative scale and an absolute offset in pixels. It is a combination of two UDim data types representing the X and Y dimensions. The most common usages for UDim2 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

概要

建構子

屬性

  • The X dimension scale and offset of the UDim2.

  • The Y dimension scale and offset of the UDim2.

  • The X dimension scale and offset of the UDim2.

  • The Y dimension scale and offset of the UDim2.

方法

  • Lerp(goal : UDim2,alpha : number):UDim2

    Returns a UDim2 interpolated linearly between the value and the given goal.

建構子

new

new

參數

xScale: number
預設值:0
xOffset: number
預設值:0
yScale: number
預設值:0
yOffset: number
預設值:0

new

參數

x: UDim
y: UDim

fromScale

參數

xScale: number
預設值:0
yScale: number
預設值:0

fromOffset

參數

xOffset: number
預設值:0
yOffset: number
預設值:0

屬性

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.

方法

Lerp

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

參數

goal: UDim2
alpha: number

返回

數學算式