UIScale
*Este contenido se traduce usando la IA (Beta) y puede contener errores. Para ver esta página en inglés, haz clic en aquí.
Un objeto UIScale contiene simplemente un número que se usa para multiplicar el GuiBase2d.AbsoluteSize del elemento de la interfaz de usuario padre. Este número se almacena en UIScale.Scale .
Muestras de código
This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.
-- 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
Resumen
Propiedades
Determina el multiplicador para aplicar al tamaño del elemento padre de la interfaz de usuario.
Propiedades
Scale
La propiedad de escala determina el multiplicador utilizado en el elemento de interfaz de usuario padre GuiBase2d.AbsoluteSize.Cuando se establece en 0.5, un tamaño absoluto de 0, 200, 0, 50 se convierte en 0, 100, 0, 25.Del mismo modo, cuando se establece en 2, un tamaño absoluto como ese se convertiría en 0, 400, 0, 100.
Muestras de código
This code sample creates some images of a lock and scales them using UIScale. It lays them out using a UIListLayout.
-- 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