UDim: Difference between revisions

From Legacy Roblox Wiki
Jump to navigationJump to search
>GoldenUrg
initial with implementation details (and description from UDim2)
>GoldenUrg
fixed layout
Line 1: Line 1:
==[[Constructors]]==
{|border="1" cellspacing="5"  style=" -webkit-border-radius: 4px; -moz-border-radius: 4px; height: 100%; background-color: #FFFFFF; border-top: dashed 2px #ff0000; border-left: dashed 2px #ff0000; border-bottom: dashed 2px #aa0000; border-right: dashed 2px #aa0000; margin: 6px; margin-right: 10px; margin-left: 10px; clear: none; padding: 2px;"
! Constructor !! Description
|-
| UDim.new('''Scale''', '''Offset''') || Creates a new UDim from components
|}
{{CatUp|Data Types}}
{{CatUp|Data Types}}


Line 19: Line 11:


The final result is a combination of Scale and Offset.  '''Scale * Parent's Size + Offset'''.
The final result is a combination of Scale and Offset.  '''Scale * Parent's Size + Offset'''.
==[[Constructors]]==
{|border="1" cellspacing="5"  style=" -webkit-border-radius: 4px; -moz-border-radius: 4px; height: 100%; background-color: #FFFFFF; border-top: dashed 2px #ff0000; border-left: dashed 2px #ff0000; border-bottom: dashed 2px #aa0000; border-right: dashed 2px #aa0000; margin: 6px; margin-right: 10px; margin-left: 10px; clear: none; padding: 2px;"
! Constructor !! Description
|-
| UDim.new('''Scale''', '''Offset''') || Creates a new UDim from components
|}


== Properties ==
== Properties ==

Revision as of 04:57, 28 April 2010

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 50% of it's parent, same as 0.38 is 38%, 0.85 is 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

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