範例程式碼
UI 縮放示範
-- 以列表佈局圖像
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- 使用 UIScale 物件創建一些不同大小的圖像
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- 鎖的圖像
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- 通過添加 UIScale 來縮放圖像,並設置大小
-- 注意:這是一個簡寫,因為我們不需要 UIScale 的引用
Instance.new("UIScale", image).Scale = size
endAPI 參考
屬性
Scale
範例程式碼
UI 縮放示範
-- 以列表佈局圖像
Instance.new("UIListLayout", script.Parent).SortOrder = Enum.SortOrder.LayoutOrder
-- 使用 UIScale 物件創建一些不同大小的圖像
for size = 0.2, 1.5, 0.2 do
local image = Instance.new("ImageLabel")
image.Image = "rbxassetid://284402752" -- 鎖的圖像
image.Parent = script.Parent
image.Size = UDim2.new(0, 100, 0, 100)
-- 通過添加 UIScale 來縮放圖像,並設置大小
-- 注意:這是一個簡寫,因為我們不需要 UIScale 的引用
Instance.new("UIScale", image).Scale = size
end