学ぶ
エンジンクラス
StyleRule

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


概要
方法
GetProperty(name: string):Variant
SetDefaultPropertyTransition(transitionParams: Variant):()
SetProperties(styleProperties: Dictionary):()
SetProperty(name: string,value: Variant):()
SetPropertyTransition(property: string,transitionParams: Variant):()
継承されたメンバー

APIリファレンス
プロパティ
Priority
並列読み取り
機能: UI
StyleRule.Priority:number

Selector
並列読み取り
機能: UI
StyleRule.Selector:string
コードサンプル
UI クラスセレクタ
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- クラスセレクタ
rule.Selector = "TextButton"
-- ルールのプロパティを設定
rule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("335FFF"),
["TextColor3"] = Color3.fromHex("E1E1E1"),
["Size"] = UDim2.new(0.15, 0, 0, 40),
["BorderSizePixel"] = 0,
})
local button = Instance.new("TextButton")
button.Text = "メインメニュー"
button.Parent = screenGui
UI タグセレクター
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- タグセレクター
rule.Selector = ".ButtonPrimary"
-- ルールプロパティの設定
rule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["TextColor3"] = Color3.fromHex("E1E1E1"),
["Size"] = UDim2.new(0.15, 0, 0, 40),
["BorderSizePixel"] = 0,
})
local button = Instance.new("TextButton")
button.Text = "メインメニュー"
button.Parent = screenGui
-- ボタンにタグを適用
CollectionService:AddTag(button, "ButtonPrimary")
UI モディファイアセレクタ
local CollectionService = game:GetService("CollectionService")
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local rule = Instance.new("StyleRule")
rule.Parent = coreSheet
-- UIコンポーネントセレクタ
rule.Selector = "Frame.RoundedCorner20::UICorner"
-- ルールプロパティを設定
rule:SetProperty("CornerRadius", UDim.new(0, 20))
-- フレームを作成
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0.4, 0, 0.2, 0)
frame.Parent = screenGui
-- フレームにタグを適用
CollectionService:AddTag(frame, "RoundedCorner20")
UIスタイルクエリセレクター
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local screenGui = script.Parent
local coreSheet = Instance.new("StyleSheet")
coreSheet.Parent = ReplicatedStorage
local styleLink = Instance.new("StyleLink")
styleLink.StyleSheet = coreSheet
styleLink.Parent = screenGui
local smallRule = Instance.new("StyleRule")
smallRule.Parent = coreSheet
local mediumRule = Instance.new("StyleRule")
mediumRule.Parent = coreSheet
-- スタイルクエリセレクターを宣言
smallRule.Selector = "@Small"
mediumRule.Selector = "@Medium"
-- ルールのプロパティを設定
smallRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["Text"] = "小さなコンテナ",
["TextColor3"] = Color3.fromHex("E1E1E1"),
["TextSize"] = 12,
})
mediumRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("F0F0F0"),
["Text"] = "中くらいのコンテナ",
["TextColor3"] = Color3.fromHex("0022FC"),
["TextSize"] = 24,
})
local button = Instance.new("TextButton")
button.Text = "メインメニュー"
button.Parent = screenGui
button.Size = UDim2.fromScale(0.5, 0.2)
-- スタイルルールセレクターに一致する名前を持つスタイルクエリを作成
local mediumSQ = Instance.new("StyleQuery")
mediumSQ.Parent = button
mediumSQ.Name = "Medium"
mediumSQ:SetConditions({
["MinSize"] = Vector2.new(200, 0),
})
local smallSQ = Instance.new("StyleQuery")\smallSQ.Parent = button
smallSQ.Name = "Small"
smallSQ:SetConditions({
["MaxSize"] = Vector2.new(200, math.huge),
["MinSize"] = Vector2.new(0, 0),
})

SelectorError
読み取り専用
複製されていません
並列読み取り
機能: UI
StyleRule.SelectorError:string

方法
GetDefaultPropertyTransition
機能: UI
StyleRule:GetDefaultPropertyTransition():Variant
戻り値
Variant

GetProperties
機能: UI
StyleRule:GetProperties():Dictionary
戻り値

GetProperty
機能: UI
StyleRule:GetProperty(name:string):Variant
パラメータ
name:string
戻り値
Variant

GetPropertyTransitions
機能: UI
StyleRule:GetPropertyTransitions():Dictionary
戻り値
コードサンプル
GetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- スタイルルールへの参照を取得
local frameRule = coreSheet.Frame
-- 一部のトランジションを設定
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(1, Enum.EasingStyle.Linear))
frameRule:SetPropertyTransition("BackgroundTransparency", "$DefaultTransition")
local transitions = frameRule:GetPropertyTransitions()
print(transitions)

SetDefaultPropertyTransition
機能: UI
StyleRule:SetDefaultPropertyTransition(transitionParams:Variant):()
パラメータ
transitionParams:Variant
戻り値
()

SetProperties
機能: UI
StyleRule:SetProperties(styleProperties:Dictionary):()
パラメータ
styleProperties:Dictionary
戻り値
()

SetProperty
機能: UI
StyleRule:SetProperty(
name:string, value:Variant
):()
パラメータ
name:string
value:Variant
戻り値
()

SetPropertyTransition
機能: UI
StyleRule:SetPropertyTransition(
property:string, transitionParams:Variant
):()
パラメータ
property:string
transitionParams:Variant
戻り値
()
コードサンプル
SetPropertyTransition()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- スタイルルールへの参照を取得
local frameRule = coreSheet.Frame
-- BackgroundColor3 に 1 秒の線形トランジションを設定
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(
1, -- 時間
Enum.EasingStyle.Linear -- イージングスタイル
))
-- トランジションを削除
frameRule:SetPropertyTransition("BackgroundColor3", nil)
トークンを使用した SetPropertyTransition()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokensSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- トークンシートにトークン(属性)を設定します
tokensSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
-- スタイルルールへの参照を取得します
local frameRule = coreSheet.Frame
frameRule:SetPropertyTransition("BackgroundColor3", "$LinearTransition")

SetPropertyTransitions
機能: UI
StyleRule:SetPropertyTransitions(properties:Dictionary):()
パラメータ
properties:Dictionary
戻り値
()
コードサンプル
SetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- スタイルルールへの参照を取得
local frameRule = coreSheet.Frame
-- 2つのプロパティの遷移を同時に設定
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = TweenInfo.new(1, Enum.EasingStyle.Linear),
["BackgroundTransparency"] = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
})
-- すべての遷移を削除
frameRule:SetPropertyTransitions({})
トークンを使用した SetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokenSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- トークン(属性)をトークンシートに設定
tokenSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
tokenSheet:SetAttribute("QuadTransition", TweenInfo.new(0.25, Enum.EasingStyle.Quad))
-- スタイルルールへの参照を取得
local frameRule = coreSheet.Frame
-- 複数のプロパティの遷移を一度に設定
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = "$LinearTransition",
["BackgroundTransparency"] = "$QuadTransition",
})

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