API 참조
속성
Image
ImageLabel.Image:ContentId
ImageTransparency
코드 샘플
이미지 투명도 진동
local RunService = game:GetService("RunService")
local imageLabel = script.Parent
local function onRenderStep()
-- 사인 파형을 사용하여 이미지 투명도를 0에서 1로 진동시킵니다
imageLabel.ImageTransparency = math.sin(workspace.DistributedGameTime * math.pi) * 0.5 + 0.5
end
RunService.RenderStepped:Connect(onRenderStep)IsLoaded
코드 샘플
이미지 로드 시간
local imageLabel = script.Parent
local startTime = workspace.DistributedGameTime
-- 이미지를 로드할 때까지 기다립니다.
while not imageLabel.IsLoaded do
task.wait()
end
-- 로드하는 데 걸린 시간을 측정하고 표시합니다.
local deltaTime = workspace.DistributedGameTime - startTime
print(("이미지가 %.3f 초에 로드되었습니다."):format(deltaTime))TileSize
코드 샘플
이미지 스케일 타입 데모
local imageLabel = script.Parent
-- 소스 이미지를 64x64 패드락으로 설정합니다
imageLabel.Image = "rbxassetid://284402752"
imageLabel.BackgroundTransparency = 0
imageLabel.BackgroundColor3 = Color3.new(1, 1, 1) -- 흰색
imageLabel.ImageColor3 = Color3.new(0, 0, 0) -- 검은색
local function resizeInACircle()
for theta = 0, 2, 0.02 do
imageLabel.Size =
UDim2.new(0, 100 + math.cos(theta * 2 * math.pi) * 50, 0, 100 + math.sin(theta * 2 * math.pi) * 50)
task.wait()
end
end
while true do
-- Stretch는 소스 이미지를 UI 요소의 공간에 맞게 늘립니다
imageLabel.ScaleType = Enum.ScaleType.Stretch
resizeInACircle()
-- Tile은 소스 이미지를 여러 번 렌더링하여
-- UI 요소의 공간을 채우기에 충분합니다
imageLabel.ScaleType = Enum.ScaleType.Tile
imageLabel.TileSize = UDim2.new(0, 64, 0, 64)
resizeInACircle()
-- Slice는 이미지를 아홉 조각 UI로 변환합니다.
imageLabel.ScaleType = Enum.ScaleType.Slice
imageLabel.SliceCenter = Rect.new(30, 30, 34, 34)
resizeInACircle()
end