学ぶ
エンジンクラス
ImageButton

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。



APIリファレンス
プロパティ
HoverImage
並列読み取り
機能: UI
ImageButton.HoverImage:ContentId

HoverImageContent
並列読み取り
機能: UI
ImageButton.HoverImageContent:Content

Image
並列読み取り
機能: UI
ImageButton.Image:ContentId
コードサンプル
画像ホバーロック
local imageLabel = script.Parent
-- この例の画像は64x64です
imageLabel.Size = UDim2.new(0, 64, 0, 64)
local function unlock()
imageLabel.Image = "rbxassetid://284402785" -- 解除された施錠アイコン (64x64)
imageLabel.ImageColor3 = Color3.new(0, 0.5, 0) -- ダークグリーン
end
local function lock()
imageLabel.Image = "rbxassetid://284402752" -- 施錠アイコン (64x64)
imageLabel.ImageColor3 = Color3.new(0.5, 0, 0) -- ダークレッド
end
-- イベントを接続する; デフォルトの状態はロックされています
imageLabel.MouseEnter:Connect(unlock)
imageLabel.MouseLeave:Connect(lock)
lock()

ImageColor3
並列読み取り
機能: UI
ImageButton.ImageColor3:Color3
コードサンプル
画像ホバーロック
local imageLabel = script.Parent
-- この例の画像は64x64です
imageLabel.Size = UDim2.new(0, 64, 0, 64)
local function unlock()
imageLabel.Image = "rbxassetid://284402785" -- 解除された施錠アイコン (64x64)
imageLabel.ImageColor3 = Color3.new(0, 0.5, 0) -- ダークグリーン
end
local function lock()
imageLabel.Image = "rbxassetid://284402752" -- 施錠アイコン (64x64)
imageLabel.ImageColor3 = Color3.new(0.5, 0, 0) -- ダークレッド
end
-- イベントを接続する; デフォルトの状態はロックされています
imageLabel.MouseEnter:Connect(unlock)
imageLabel.MouseLeave:Connect(lock)
lock()

ImageContent
並列読み取り
機能: UI
ImageButton.ImageContent:Content

ImageRectOffset
並列読み取り
機能: UI
ImageButton.ImageRectOffset:Vector2
コードサンプル
スプライトシートを使用した画像アニメーション
-- 256x256のサイズのImageLabel/ImageButtonにこれを置きます
local imageLabel = script.Parent
-- 次の画像は1024x1024で、12フレーム(256x256)です
-- フレームは男性がパンチを放つアニメーションを再生します
imageLabel.Image = "rbxassetid://848623155"
imageLabel.ImageRectSize = Vector2.new(256, 256)
-- 表示されるフレームの順序(左から右、その後上から下)
local frames = {
Vector2.new(0, 0),
Vector2.new(1, 0),
Vector2.new(2, 0),
Vector2.new(3, 0),
Vector2.new(0, 1),
Vector2.new(1, 1),
Vector2.new(2, 1),
Vector2.new(3, 1),
Vector2.new(0, 2),
Vector2.new(1, 2),
Vector2.new(2, 2),
Vector2.new(3, 2),
}
-- フレームを一度に1つずつループしてアニメート
while true do
for _, frame in ipairs(frames) do
imageLabel.ImageRectOffset = frame * imageLabel.ImageRectSize
task.wait(0.1)
end
end

ImageRectSize
並列読み取り
機能: UI
ImageButton.ImageRectSize:Vector2
コードサンプル
スプライトシートを使用した画像アニメーション
-- 256x256のサイズのImageLabel/ImageButtonにこれを置きます
local imageLabel = script.Parent
-- 次の画像は1024x1024で、12フレーム(256x256)です
-- フレームは男性がパンチを放つアニメーションを再生します
imageLabel.Image = "rbxassetid://848623155"
imageLabel.ImageRectSize = Vector2.new(256, 256)
-- 表示されるフレームの順序(左から右、その後上から下)
local frames = {
Vector2.new(0, 0),
Vector2.new(1, 0),
Vector2.new(2, 0),
Vector2.new(3, 0),
Vector2.new(0, 1),
Vector2.new(1, 1),
Vector2.new(2, 1),
Vector2.new(3, 1),
Vector2.new(0, 2),
Vector2.new(1, 2),
Vector2.new(2, 2),
Vector2.new(3, 2),
}
-- フレームを一度に1つずつループしてアニメート
while true do
for _, frame in ipairs(frames) do
imageLabel.ImageRectOffset = frame * imageLabel.ImageRectSize
task.wait(0.1)
end
end

ImageTransparency
並列読み取り
機能: UI
ImageButton.ImageTransparency:number

IsLoaded
読み取り専用
複製されていません
並列読み取り
機能: UI
ImageButton.IsLoaded:boolean
コードサンプル
画像の読み込み時間
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))

PressedImage
並列読み取り
機能: UI
ImageButton.PressedImage:ContentId

PressedImageContent
並列読み取り
機能: UI
ImageButton.PressedImageContent:Content

ResampleMode
並列読み取り
機能: UI
ImageButton.ResampleMode:Enum.ResamplerMode

ScaleType
並列読み取り
機能: UI
ImageButton.ScaleType:Enum.ScaleType

SliceCenter
並列読み取り
機能: UI
ImageButton.SliceCenter:Rect

SliceScale
並列読み取り
機能: UI
ImageButton.SliceScale:number

TileSize
並列読み取り
機能: UI
ImageButton.TileSize:UDim2

©2026 Roblox Corporation。Roblox(ロブロックス)、RobloxロゴおよびPowering Imaginationは、米国並びにその他の国における登録商標および非登録商標です。