エンジンクラス
KeyframeSequenceProvider
*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。
概要
方法
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 |
コードサンプル
一時アニメーションを作成
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リファレンス
方法
GetAnimations
GetAnimationsAsync
パラメータ
戻り値
コードサンプル
キーフレームシーケンスプロバイダー GetAnimationsAsync
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local USER_ID = 0 -- ここにあなたのUserIdを挿入してください
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("合計: ", #animationIds)GetKeyframeSequence
GetKeyframeSequenceAsync
パラメータ
assetId:ContentId |
戻り値
コードサンプル
アニメーションのKeyframeSequenceを取得する
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local ANIMATION_ID = "rbxassetid://507771019"
-- アセットのキーフレームシーケンスを取得する
local keyframeSequence
local success, err = pcall(function()
keyframeSequence = KeyframeSequenceProvider:GetKeyframeSequenceAsync(ANIMATION_ID)
end)
if success then
-- 各キーフレームを反復処理し、その時間値を印刷する
local keyframeTable = keyframeSequence:GetKeyframes()
for key, value in keyframeTable do
print(`キーフレーム番号 {key} の時間は: {value.Time}`)
end
else
print(`KeyframeSequenceの取得中にエラーが発生しました: {err}`)
endGetKeyframeSequenceById
RegisterActiveKeyframeSequence
パラメータ
戻り値
ContentId
コードサンプル
一時アニメーションを作成
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
コードサンプル
キーフレームシーケンスプロバイダー:RegisterKeyframeSequence
local KeyframeSequenceProvider = game:GetService("KeyframeSequenceProvider")
local asset = KeyframeSequenceProvider:RegisterKeyframeSequence(workspace.KeyframeSequence)
local animation = Instance.new("Animation")
animation.Name = "テストアニメーション"
animation.AnimationId = asset
animation.Parent = workspace