UIScale

Mostrar obsoleto

*Este conteúdo é traduzido por IA (Beta) e pode conter erros. Para ver a página em inglês, clique aqui.

Um objeto UIScale simplesmente contém um número que é usado para multiplicar o GuiBase2d.AbsoluteSize do elemento de UI pai. Este número é armazenado em UIScale.Scale.

Amostras de código

This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.

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

Propriedades

Scale

Ler Parallel

A propriedade Escala determina o multiplicador usado no elemento de UI pai GuiBase2d.AbsoluteSize.Quando definido como 0.5, um Tamanho Absoluto de 0, 200, 0, 50 se torna 0, 100, 0, 25.Da mesma forma, quando definido como 2, tal tamanho absoluto se tornaria 0, 400, 0, 100.

Amostras de código

This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.

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

Métodos

Eventos