/
UDim2.yaml
236 lines (230 loc) · 7.06 KB
/
UDim2.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
name: UDim2
type: datatype
summary: |
Represents a two-dimensional value where each dimension is composed of a
relative scale and an absolute offset.
description: |
The `Datatype.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 `Datatype.UDim` representing the X and Y dimensions. The
most common usages of `Datatype.UDim2` objects are setting the
`Class.GuiObject.Size|Size` and `Class.GuiObject.Position|Position` of
`Class.GuiObject|GuiObjects`.
```lua
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 `Datatype.UDim2` data type:
<table>
<thead>
<tr>
<td>Operation</td>
<td>Description</td>
</tr>
</thead>
<tbody>
<tr>
<td><code>Datatype.UDim2</code> <code>+</code> <code>Datatype.UDim2</code></td>
<td>Produces a <code>Datatype.UDim2</code> with components that are the sum of the respective components of the two <code>Datatype.UDim2</code> objects.</td>
</tr>
<tr>
<td><code>Datatype.UDim2</code> <code>-</code> <code>Datatype.UDim2</code></td>
<td>Produces a <code>Datatype.UDim2</code> with components that are the difference of the respective components of the two <code>Datatype.UDim2</code> objects.</td>
</tr>
</tbody>
</table>
code_samples:
tags: []
deprecation_message: ''
constructors:
- name: UDim2.new
summary: |-
Returns a new `Datatype.UDim2` with the coordinates of the two zero `Datatype.UDim`
representing each axis.
description: |-
Returns a new `Datatype.UDim2` with the coordinates of the two zero `Datatype.UDim`
representing each axis.
parameters:
code_samples: []
tags: []
deprecation_message: ''
- name: UDim2.new
summary: |-
Returns a new `Datatype.UDim2` given the coordinates of the two `Datatype.UDim`
components representing each axis.
description: |-
Returns a new `Datatype.UDim2` given the coordinates of the two `Datatype.UDim`
components representing each axis.
parameters:
- name: xScale
type: number
default: 0
summary: |
The X dimension scale.
- name: xOffset
type: number
default: 0
summary: |
The X dimension offset.
- name: yScale
type: number
default: 0
summary: |
The Y dimension scale.
- name: yOffset
type: number
default: 0
summary: |
The Y dimension offset.
code_samples: []
tags: []
deprecation_message: ''
- name: UDim2.new
summary: |-
Returns a new `Datatype.UDim2` from the given `Datatype.UDim` objects representing
the X and Y dimensions, respectively.
description: |-
Returns a new `Datatype.UDim2` from the given `Datatype.UDim` objects representing
the X and Y dimensions, respectively.
parameters:
- name: x
type: UDim
default:
summary: ''
- name: 'y'
type: UDim
default:
summary: ''
code_samples: []
tags: []
deprecation_message: ''
- name: UDim2.fromScale
summary: Returns a new `Datatype.UDim2` with the given scale components and no offsets.
description: |-
Returns a new `Datatype.UDim2` with the given scalar coordinates and no offsets. Equivalent to:
```lua
UDim2.fromScale(xScale, yScale) == UDim2.new(xScale, 0, yScale, 0)
```
parameters:
- name: xScale
type: number
default: 0
summary: ''
- name: yScale
type: number
default: 0
summary: ''
code_samples: []
tags: []
deprecation_message: ''
- name: UDim2.fromOffset
summary: Returns a new `Datatype.UDim2` with the given offset components and no scales.
description: |-
Returns a new `Datatype.UDim2` with the given offset coordinates and no scales. Equivalent to:
```lua
UDim2.fromOffset(xOffset, yOffset) == UDim2.new(0, xOffset, 0, yOffset)
```
parameters:
- name: xOffset
type: number
default: 0
summary: ''
- name: yOffset
type: number
default: 0
summary: ''
code_samples: []
tags: []
deprecation_message: ''
constants: []
properties:
- name: UDim2.X
type: UDim
summary: |
The X dimension scale and offset of the `Datatype.UDim2`.
description: |
The X dimension scale and offset of the `Datatype.UDim2`.
code_samples: []
tags: []
deprecation_message: ''
- name: UDim2.Y
type: UDim
summary: |
The Y dimension scale and offset of the `Datatype.UDim2`.
description: |
The Y dimension scale and offset of the `Datatype.UDim2`.
code_samples: []
tags: []
deprecation_message: ''
- name: UDim2.Width
type: UDim
summary: |
The X dimension scale and offset of the `Datatype.UDim2`.
description: |
The X dimension scale and offset of the `Datatype.UDim2`.
code_samples: []
tags: []
deprecation_message: ''
- name: UDim2.Height
type: UDim
summary: |
The Y dimension scale and offset of the `Datatype.UDim2`.
description: |
The Y dimension scale and offset of the `Datatype.UDim2`.
code_samples: []
tags: []
deprecation_message: ''
methods:
- name: UDim2:Lerp
summary: |
Returns a `Datatype.UDim2` interpolated linearly between the value and the
given goal.
description: |
Returns a `Datatype.UDim2` interpolated linearly between this
`Datatype.UDim2` and the given `goal`. The `alpha` value should be a
number between 0 and 1.
parameters:
- name: goal
type: UDim2
default:
summary: ''
- name: alpha
type: number
default:
summary: ''
returns:
- type: UDim2
summary: ''
code_samples: []
tags: []
deprecation_message: ''
functions:
math_operations:
- operation: +
summary: |
Produces a `Datatype.UDim2` with components that are the sum of the
respective components of the two `Datatype.UDim2` objects.
description: |
Produces a `Datatype.UDim2` with components that are the sum of the
respective components of the two `Datatype.UDim2` objects.
type_a: UDim2
type_b: UDim2
return_type: UDim2
code_samples: []
tags: []
deprecation_message: ''
- operation: '-'
summary: |
Produces a `Datatype.UDim2` with components that are the difference of the
respective components of the two `Datatype.UDim2` objects.
description: |
Produces a `Datatype.UDim2` with components that are the difference of the
respective components of the two `Datatype.UDim2` objects.
type_a: UDim2
type_b: UDim2
return_type: UDim2
code_samples: []
tags: []
deprecation_message: ''