KeyframeSequenceProvider

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
서비스
복제되지 않음

키프레임 시퀀스 공급자 서비스는 기능을 제공하여 를 로드하고 미리보기합니다.그것은 Animations로 작업할 때 유용한 여러 기능을 포함합니다.

A KeyframeSequence 는 애니메이션의 계층과 움직임을 인코딩하는 일련의 Poses 를 저장합니다.Animation.AnimationId 속성에 의해 참조되는 애니메이션 재생에서 Roblox가 사용하는 애니메이션 데이터는 KeyframeSequence에서 생성될 수 있습니다.KeyframeSequences 는 일반적으로 Roblox 애니메이션 편집기 에 의해 생성되지만 다른 플러그인을 통해 또는 수동으로 생성할 수도 있습니다.

코드 샘플

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)

요약

메서드

속성

메서드

RegisterActiveKeyframeSequence

ContentId

매개 변수

keyframeSequence: Instance
기본값: ""

반환

ContentId

코드 샘플

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

매개 변수

keyframeSequence: Instance
기본값: ""

반환

ContentId

코드 샘플

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

생성

매개 변수

userId: number
기본값: ""

반환

코드 샘플

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

생성

매개 변수

assetId: ContentId
기본값: ""

반환

코드 샘플

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

이벤트