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

애니메이션의 지역화된 테스트에 사용할 수 있는 임시 자산 ID를 생성하는 KeyframeSequence에서 애니메이션의 지역화된 테스트에 사용할 수 있는 임시 자산 ID를 생성합니다.

이 함수는 동일한 기능을 수행하지만 KeyframeSequenceProvider:RegisterKeyframeSequence() 이 함수는 해시 대신 active:// URL을 생성합니다.

생성된 ID는 테스트용 Animation.AnimationId 속성에서 사용할 수 있습니다.

이 함수에서 생성된 자산 ID는 임시이며 Studio 외부에서 사용할 수 없습니다.온라인으로 사용할 수 있는 자산 ID를 생성하려는 개발자는 Roblox에 KeyframeSequence를 업로드해야 합니다.

매개 변수

keyframeSequence: Instance

사용할 KeyframeSequence 입니다.

기본값: ""

반환

ContentId

로컬화된 애니메이션 재생을 위해 생성된 임시 자산 ID.

코드 샘플

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)

RegisterKeyframeSequence

ContentId

애니메이션의 지역화된 테스트에 사용할 수 있는 임시 자산 ID를 생성하는 KeyframeSequence에서 애니메이션의 지역화된 테스트에 사용할 수 있는 임시 자산 ID를 생성합니다.

이 함수는 동일한 기능을 수행하지만 KeyframeSequenceProvider:RegisterActiveKeyframeSequence() 이 함수는 active:// URL 대신 해시를 생성합니다.

생성된 ID는 애니메이션을 테스트하기 위한 Animation.AnimationId 속성에 사용할 수 있습니다.

이 함수에서 생성된 자산 ID는 임시이며 Studio 외부에서 사용할 수 없습니다.온라인으로 사용할 수 있는 자산 ID를 생성하려는 개발자는 Roblox에 KeyframeSequence를 업로드해야 합니다.

매개 변수

keyframeSequence: Instance

사용할 KeyframeSequence 입니다.

기본값: ""

반환

ContentId

로컬화된 애니메이션 재생을 위해 생성된 임시 자산 ID.

코드 샘플

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

생성

이 함수는 특정 사용자가 소유하는 애니메이션을 반복할 수 있는 InventoryPages 개체를 반환합니다.

이 함수에는 사용자가 사용자 지정 애니메이션 플러그인에 애니메이션을 탐색하고 가져올 수 있도록 하는 것과 같은 여러 가지 잠재적 사용 방법이 있습니다.

매개 변수

userId: number

사용자의 사용자 ID.

기본값: ""

반환

애니메이션의 InventoryPages입니다.

코드 샘플

This code sample includes a demonstration of how the content IDs of animations belonging to a player can be downloaded using KeyframeSequenceProvider:GetAnimations(). To run this code be sure to change the USER_ID variable to the ID of the user whose animations you want to download.

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

생성

GetKeyframeSequenceAsync는 지정된 자산ID에 따라 KeyframeSequence 을 반환합니다.자산ID는 애니메이션과 일치해야 합니다.함수는 웹사이트에서 KeyframeSequence 가 로드될 때까지 생성됩니다.이것은 웹콜이기 때문에 pcall로 감싸야 합니다.

매개 변수

assetId: ContentId

애니메이션의 콘텐트 ID.

기본값: ""

반환

코드 샘플

Demonstrates getting an animation's KeyframeSequence using KeyframeSequenceProvider:GetKeyframeSequenceAsync() and printing the time of each keyframe.

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

이벤트