UDim: Difference between revisions
>SoulStealer9875 No edit summary |
>Legend26 No edit summary |
||
Line 13: | Line 13: | ||
==[[Constructors]]== | ==[[Constructors]]== | ||
{| | {| class="wikitable" | ||
! Constructor !! Description | ! Constructor !! Description | ||
|- | |- | ||
Line 27: | Line 27: | ||
All of these properties are Read Only (you can't just set them UDim.Scale = 5, it doesn't work) but you can create new UDim.new( 5, UDim.Offset ). | All of these properties are Read Only (you can't just set them UDim.Scale = 5, it doesn't work) but you can create new UDim.new( 5, UDim.Offset ). | ||
{| | {| class="wikitable" | ||
! Property !! Type !! Description | ! Property !! Type !! Description | ||
|- | |- | ||
Line 36: | Line 36: | ||
== Operators == | == Operators == | ||
{| | {| class="wikitable" | ||
! Operation !! Description | ! Operation !! Description | ||
|- | |- |
Revision as of 04:12, 20 January 2012
Description
UDim stands for Universal Dimension, and uses 2 coordinates.
A UDim consists of a Scale and an Offset. These are used to figure out where exactly the UDim's position is.
Scale is a number between 0.0 and 1.0 that is a percentage of the parent object's size. For example, if the parent object is 50 pixels wide, a UDim scale of 0.5 would be 25 pixels wide. 0.5 makes the size cover 50% of it's parent, same as 0.38 is going to cover 38%, 0.85 is going to cover 85%, and so on.
Offset is a specified Integer. This is a non changing value that is factored into the UDim calculation.
The final result is a combination of Scale and Offset. Scale * Parent's Size + Offset.
Constructors
Constructor | Description |
---|---|
UDim.new(Scale, Offset) | Creates a new UDim from components |
GuiObject.Size = UDim2.new(0, 100, 0, 100) (GuiObject.Size = UDim2.new(X.Scale, X.Offset, Y.Scale, Y.Offset))
Properties
All of these properties are Read Only (you can't just set them UDim.Scale = 5, it doesn't work) but you can create new UDim.new( 5, UDim.Offset ).
Property | Type | Description |
---|---|---|
UDim.Scale | Number | The scale value |
UDim.Offset | Number | The offset value |
Operators
Operation | Description |
---|---|
UDim + UDim | returns UDim with each component added individually |