Engine-Klasse
KeyframeSequenceProvider
*Dieser Inhalt wurde mit KI (Beta) übersetzt und kann Fehler enthalten. Um diese Seite auf Englisch zu sehen, klicke hier.
Zusammenfassung
Methoden
GetAnimations(userId: User):Instance |
GetAnimationsAsync(userId: User):Instance |
GetKeyframeSequence(assetId: ContentId):Instance |
GetKeyframeSequenceAsync(assetId: ContentId):Instance |
GetKeyframeSequenceById(assetId: number,useCache: boolean):Instance |
RegisterActiveKeyframeSequence(keyframeSequence: Instance):ContentId |
RegisterKeyframeSequence(keyframeSequence: Instance):ContentId |
Code-Beispiele
Erstelle temporäre 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)API-Referenz
Methoden
GetAnimations
GetAnimationsAsync
Parameter
Rückgaben
Code-Beispiele
KeyframeSequenceProvider GetAnimationsAsync
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local USER_ID = 0 -- Hier Ihre UserId einfügen
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:GetAnimationsAsync(USER_ID)
local animationIds = extractPages(inventoryPages)
for _, id in pairs(animationIds) do
print(id)
end
print("gesamt: ", #animationIds)GetKeyframeSequence
GetKeyframeSequenceAsync
Parameter
assetId:ContentId |
Rückgaben
Code-Beispiele
Abrufen der KeyframeSequence einer Animation
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local ANIMATION_ID = "rbxassetid://507771019"
-- Hole die Keyframe-Sequenz für das Asset
local keyframeSequence
local success, err = pcall(function()
keyframeSequence = KeyframeSequenceProvider:GetKeyframeSequenceAsync(ANIMATION_ID)
end)
if success then
-- Iteriere über jedes Keyframe und gebe dessen Zeitwert aus
local keyframeTable = keyframeSequence:GetKeyframes()
for key, value in keyframeTable do
print(`Die Zeit des Keyframes Nummer {key} ist: {value.Time}`)
end
else
print(`Fehler beim Abrufen der KeyframeSequence: {err}`)
endGetKeyframeSequenceById
RegisterActiveKeyframeSequence
Parameter
Rückgaben
ContentId
Code-Beispiele
Erstelle temporäre 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
Parameter
Rückgaben
ContentId
Code-Beispiele
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