KeyframeSequenceProvider

Artık kullanılmayanları göster

*Bu içerik, yapay zekâ (beta) kullanılarak çevrildi ve hatalar içerebilir. Sayfayı İngilizce görüntülemek için buraya tıkla.

Oluşturulamaz
Hizmet
Çoğaltılmamış

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.

Create temporary animation

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

Yöntemler

Özellikler

Yöntemler

RegisterActiveKeyframeSequence

ContentId

Parametreler

keyframeSequence: Instance
Varsayılan değer: ""

Dönüşler

ContentId

Kod Örnekleri

Create temporary animation

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

ContentId

Parametreler

keyframeSequence: Instance
Varsayılan değer: ""

Dönüşler

ContentId

Kod Örnekleri

KeyframeSequenceProvider:RegisterKeyframeSequence

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

Bekletir

Parametreler

userId: number
Varsayılan değer: ""

Dönüşler

Kod Örnekleri

KeyframeSequenceProvider GetAnimations

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

Bekletir

Parametreler

assetId: ContentId
Varsayılan değer: ""

Dönüşler

Kod Örnekleri

Getting an animation's KeyframeSequence

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

Olaylar