UIScale
*Konten ini diterjemahkan menggunakan AI (Beta) dan mungkin mengandung kesalahan. Untuk melihat halaman ini dalam bahasa Inggris, klik di sini.
Objek UIScale hanya berisi angka yang digunakan untuk menggandakan GuiBase2d.AbsoluteSize dari elemen UI orang tua. Angka ini disimpan di UIScale.Scale .
Contoh Kode
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
Rangkuman
Properti
Menentukan pengganda untuk diterapkan pada ukuran elemen UI orang tua.
Properti
Scale
Properti Skala menentukan pengganda yang digunakan pada elemen UI orangtua GuiBase2d.AbsoluteSize.Ketika diatur ke 0,5, Ukuran Absolut 0, 200, 0, 50 menjadi 0, 100, 0, 25.Demikian pula, ketika diatur ke 2, ukuran absolut seperti itu akan menjadi 0, 400, 0, 100.
Contoh Kode
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