UIScale 개체는 단순히 부모 UI 요소의 GuiBase2d.AbsoluteSize를 곱하는 데 사용되는 숫자를 포함합니다. 이 숫자는 UIScale.Scale에 저장됩니다.
코드 샘플
UI Scale Demo
-- Lay out the images in a list
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- Create some images of varying sizes using UIScale objects
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- an image of a Lock
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- Scale the image by adding a UIScale with the size
-- Note: this is a shorthand since we don't need a reference to the UIScale
Instance.new("UIScale", image).Scale = size
end
요약
속성
Scale
규모 속성은 부모 UI 요소의 GuiBase2d.AbsoluteSize에 사용되는 배수를 결정합니다.0.5로 설정되면 0, 200, 0, 50의 절대 크기가 0, 100, 0, 25가 됩니다.마찬가지로, 2로 설정되면 이러한 절대 크기는 0, 400, 0, 100이 됩니다.
코드 샘플
UI Scale Demo
-- Lay out the images in a list
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- Create some images of varying sizes using UIScale objects
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- an image of a Lock
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- Scale the image by adding a UIScale with the size
-- Note: this is a shorthand since we don't need a reference to the UIScale
Instance.new("UIScale", image).Scale = size
end