UIScale
แสดงที่เลิกใช้งานแล้ว
*เนื้อหานี้แปลโดยใช้ AI (เวอร์ชัน Beta) และอาจมีข้อผิดพลาด หากต้องการดูหน้านี้เป็นภาษาอังกฤษ ให้คลิกที่นี่
วัตถุ UIScale เพียงแค่มีตัวเลขที่ใช้ในการคูณ GuiBase2d.AbsoluteSize ขององค์ประกอบ UI ราก ตัวเลขนี้จะถูกเก็บไว้ใน UIScale.Scale
ตัวอย่างโค้ด
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
สรุป
คุณสมบัติ
กำหนดตัวคูณที่จะใช้กับขนาดขององค์ประกอบ UI ราก
คุณสมบัติ
Scale
คุณสมบัติเครื่องชั่งกำหนดตัวคูณที่ใช้กับองค์ประกอบ UI ระดับบน GuiBase2d.AbsoluteSizeเมื่อตั้งค่าเป็น 0.5 ขนาดสัมบูรณ์ของ 0, 200, 0, 50 จะกลายเป็น 0, 100, 0, 25เช่นเดียวกันเมื่อตั้งค่าเป็น 2 ขนาดสัมบูรณ์ดังกล่าวจะกลายเป็น 0, 400, 0, 100
ตัวอย่างโค้ด
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