KeyframeSequenceProvider
*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.
Anahtar çerçeve seckeci sağlayıcısı hizmeti, yükleme ve önizleme işlevleri sağlar.Animations ile çalışırken yararlı bir dizi işlev içerir.
Bir KeyframeSequence bir animasyonun sıralamasını ve hareketini kodlayan bir dizi Poses saklarBir animasyonun oynatılmasında Roblox'un kullandığı animasyon verileri, Animation.AnimationId özelliği tarafından referanslandırılan, bir KeyframeSequence 'dan inşa edilebilir.KeyframeSequences genellikle Roblox Animasyon Editörü tarafından oluşturulur, ancak diğer pluginler veya hatta manuel olarak oluşturulabilir.
Kod Örnekleri
This code sample contains a simple function to generate an Animation with a generated hash ID to preview a KeyframeSequence locally.
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local function createPreviewAnimation(keyframeSequence)
local hashId = KeyframeSequenceProvider:RegisterKeyframeSequence(keyframeSequence)
local Animation = Instance.new("Animation")
Animation.AnimationId = hashId
return Animation
end
local keyframeSequence = Instance.new("KeyframeSequence")
local animation = createPreviewAnimation(keyframeSequence)
print(animation)
Özet
Özellikler
Yöntemler
Bir animasyonun yerelleştirilmiş test edilmesi için kullanılabilecek geçici bir varlık kimliği oluşturur KeyframeSequence . Bir aktif:// URL üretir.
Bir animasyonun yerelleştirilmiş test edilmesi için kullanılabilecek geçici bir varlık kimliği oluşturur KeyframeSequence . Bir hash oluşturur.
Bu işlev, belirli bir kullanıcının sahip olduğu animasyonlar üzerinde döngü yapmak için kullanılabilecek bir InventoryPages nesnesi döndürür.
Belirtilen varlıkID'ye göre asenkron olarak bir Anahtar Çerçeve Sekansı döndürür.
Özellikler
Yöntemler
RegisterActiveKeyframeSequence
Parametreler
Dönüşler
Kod Örnekleri
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local function createPreviewAnimation(keyframeSequence)
local hashId = KeyframeSequenceProvider:RegisterKeyframeSequence(keyframeSequence)
local Animation = Instance.new("Animation")
Animation.AnimationId = hashId
return Animation
end
local keyframeSequence = Instance.new("KeyframeSequence")
local animation = createPreviewAnimation(keyframeSequence)
print(animation)
RegisterKeyframeSequence
Parametreler
Dönüşler
Kod Örnekleri
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local asset = KeyframeSequenceProvider:RegisterKeyframeSequence(workspace.KeyframeSequence)
local animation = Instance.new("Animation")
animation.Name = "TestAnimation"
animation.AnimationId = asset
animation.Parent = workspace
GetAnimations
Parametreler
Dönüşler
Kod Örnekleri
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local USER_ID = 0 -- Insert your UserId here
local function extractPages(pagesObject)
local array = {}
while true do
local thisPage = pagesObject:GetCurrentPage()
for _, v in pairs(thisPage) do
table.insert(array, v)
end
if pagesObject.IsFinished then
break
end
pagesObject:AdvanceToNextPageAsync()
end
return array
end
local inventoryPages = KeyframeSequenceProvider:GetAnimations(USER_ID)
local animationIds = extractPages(inventoryPages)
for _, id in pairs(animationIds) do
print(id)
end
print("total: ", #animationIds)
GetKeyframeSequenceAsync
Parametreler
Dönüşler
Kod Örnekleri
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local ANIMATION_ID = "rbxassetid://507771019"
-- Get the keyframe sequence for the asset
local keyframeSequence
local success, err = pcall(function()
keyframeSequence = KeyframeSequenceProvider:GetKeyframeSequenceAsync(ANIMATION_ID)
end)
if success then
-- Iterate over each keyframe and print its time value
local keyframeTable = keyframeSequence:GetKeyframes()
for key, value in keyframeTable do
print(`The time of keyframe number {key} is: {value.Time}`)
end
else
print(`Error getting KeyframeSequence: {err}`)
end