Motor Sınıfı
StyleRule
*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.
Özet
Yöntemler
GetDefaultPropertyTransition():Variant |
GetProperty(name: string):Variant |
SetDefaultPropertyTransition(transitionParams: Variant):() |
SetProperties(styleProperties: Dictionary):() |
SetProperty(name: string,value: Variant):() |
SetPropertyTransition(property: string,transitionParams: Variant):() |
SetPropertyTransitions(properties: Dictionary):() |
API Referansı
Özellikler
Selector
Kod Örnekleri
UI Sınıf Seçici
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
-- Sınıf seçici
rule.Selector = "TextButton"
-- Kural özelliklerini ayarla
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 = "Ana Menü"
button.Parent = screenGuiUI Etiket Seçici
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
-- Etiket seçici
rule.Selector = ".ButtonPrimary"
-- Kural özelliklerini ayarla
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 = "Ana Menü"
button.Parent = screenGui
-- Butona etiket uygula
CollectionService:AddTag(button, "ButtonPrimary")UI Modifikatör Seçici
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 bileşen seçici
rule.Selector = "Frame.RoundedCorner20::UICorner"
-- Kural özelliğini ayarla
rule:SetProperty("CornerRadius", UDim.new(0, 20))
-- Çerçeve oluştur
local frame = Instance.new("Frame")
frame.Size = UDim2.new(0.4, 0, 0.2, 0)
frame.Parent = screenGui
-- Çerçeveye etiket uygula
CollectionService:AddTag(frame, "RoundedCorner20")UI Stil Sorgu Seçici
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
-- Stil sorgu seçicilerini tanımlayın
smallRule.Selector = "@Small"
mediumRule.Selector = "@Medium"
-- Kural özelliklerini ayarlayın
smallRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("FF0099"),
["Text"] = "Küçük Kapsayıcı",
["TextColor3"] = Color3.fromHex("E1E1E1"),
["TextSize"] = 12,
})
mediumRule:SetProperties({
["BackgroundColor3"] = Color3.fromHex("F0F0F0"),
["Text"] = "Orta Kapsayıcı",
["TextColor3"] = Color3.fromHex("0022FC"),
["TextSize"] = 24,
})
local button = Instance.new("TextButton")
button.Text = "Ana Menü"
button.Parent = screenGui
button.Size = UDim2.fromScale(0.5, 0.2)
-- Stil kural seçicileri ile eşleşen isimlerle stil sorguları oluşturun
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),
})Yöntemler
GetDefaultPropertyTransition
StyleRule:GetDefaultPropertyTransition():Variant
Dönüşler
Variant
GetPropertyTransitions
Dönüşler
Kod Örnekleri
GetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Stil kuralına referans alın
local frameRule = coreSheet.Frame
-- Bazı geçişler ayarlayın
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(1, Enum.EasingStyle.Linear))
frameRule:SetPropertyTransition("BackgroundTransparency", "$DefaultTransition")
local transitions = frameRule:GetPropertyTransitions()
print(transitions)SetDefaultPropertyTransition
StyleRule:SetDefaultPropertyTransition(transitionParams:Variant):()
Parametreler
transitionParams:Variant |
Dönüşler
()
SetProperties
Parametreler
Dönüşler
()
SetProperty
SetPropertyTransition
Parametreler
transitionParams:Variant |
Dönüşler
()
Kod Örnekleri
SetPropertyTransition()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Stil kuralına referansı al
local frameRule = coreSheet.Frame
-- BackgroundColor3'te 1 saniyelik lineer geçiş ayarla
frameRule:SetPropertyTransition("BackgroundColor3", TweenInfo.new(
1, -- Zaman
Enum.EasingStyle.Linear -- EasingStyle
))
-- Geçişi kaldır
frameRule:SetPropertyTransition("BackgroundColor3", nil)SetPropertyTransition() Kullanarak Jetonlar
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokensSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Jetonları (özellikleri) jetonlar sayfasına ayarla
tokensSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
-- Stil kuralına referans al
local frameRule = coreSheet.Frame
frameRule:SetPropertyTransition("BackgroundColor3", "$LinearTransition")SetPropertyTransitions
Parametreler
Dönüşler
()
Kod Örnekleri
SetPropertyTransitions()
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
-- Stil kuralına referans al
local frameRule = coreSheet.Frame
-- İki özellik için geçişleri aynı anda ayarlar
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = TweenInfo.new(1, Enum.EasingStyle.Linear),
["BackgroundTransparency"] = TweenInfo.new(0.25, Enum.EasingStyle.Quad, Enum.EasingDirection.Out),
})
-- Tüm geçişleri kaldır
frameRule:SetPropertyTransitions({})SetPropertyTransitions() Kullanarak Tokenler
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local coreSheet = ReplicatedStorage:FindFirstChild("CoreSheet")
local tokenSheet = ReplicatedStorage:FindFirstChild("Tokens")
-- Token sayfasında tokenları (özellikleri) ayarla
tokenSheet:SetAttribute("LinearTransition", TweenInfo.new(1, Enum.EasingStyle.Linear))
tokenSheet:SetAttribute("QuadTransition", TweenInfo.new(0.25, Enum.EasingStyle.Quad))
-- Stil kuralına referans al
local frameRule = coreSheet.Frame
-- Birden fazla özellik için geçişleri aynı anda ayarla
frameRule:SetPropertyTransitions({
["BackgroundColor3"] = "$LinearTransition",
["BackgroundTransparency"] = "$QuadTransition",
})