AnimationTrack
AnimationTrack : Instance
Overview
์ ๋๋ฉ์ดํฐ์ ์ ์ฉ๋ ์ ๋๋ฉ์ด์ ์ ์คํ์ ๊ด๋ฆฌํ๋ ๊ฐ์ฒด์ ๋๋ค.
์ด ๊ฐ์ฒด๋ Animator์ LoadAnimation() ๋ฉ์๋๋ฅผ ํธ์ถํด์ผ๋ง ์ป์ ์ ์์ต๋๋ค.
Properties
Animation
Animation
AnimationTrack์ ์ค์ ๋ Animation ๊ฐ์ฒด๋ฅผ ๋ฐํํ๋ ์์ฑ์ ๋๋ค. (์ฝ๊ธฐ ์ ์ฉ)
Code Samples
print(AnimationTrack.Animation)
IsPlaying
bool
์ ๋๋ฉ์ด์ ํธ๋์ ์คํ ์ฌ๋ถ๋ฅผ ๋ฐํํ๋ ์์ฑ์ ๋๋ค. (์ฝ๊ธฐ ์ ์ฉ)
Code Samples
AnimationTrack:Play()
if AnimationTrack.IsPlaying then
print("DoSomething")
end
Length
number
์ ๋๋ฉ์ด์ ํธ๋์ ์ ์ฒด ์ฌ์ ์๊ฐ์ ์ด ๋จ์๋ก ๋ฐํํ๋ ์์ฑ์ ๋๋ค. (์ฝ๊ธฐ ์ ์ฉ)
Code Samples
print(AnimationTrack.Length)
Looped
bool
์ ๋๋ฉ์ด์ ์๋ฃ ํ ์๋์ผ๋ก ๋ค์ ๋ฐ๋ณต ์คํํ ์ง๋ฅผ ์ง์ ํ๋ ์์ฑ์ ๋๋ค.
์ด ์์ฑ์ ์ ๋๋ฉ์ด์ ์ ์คํํ๊ธฐ ์ ์ ๋ฏธ๋ฆฌ ์ง์ ํด์ผ ์ ์์ ์ผ๋ก ๋ฐ์๋ฉ๋๋ค. ์คํ ์ค์ ๊ฐ์ ๋ณ๊ฒฝํ ๊ฒฝ์ฐ, ํด๋น ์ ๋๋ฉ์ด์ ์ด ์ข ๋ฃ๋ ๋ค ๊ธฐ๋ณธ ์ ๋๋ฉ์ด์ ์ผ๋ก ๋์๊ฐ์ง ์๊ณ ๊ทธ๋๋ก ๋ฉ์ถ ์ ์์ผ๋ฏ๋ก ์ฃผ์๊ฐ ํ์ํฉ๋๋ค.
Code Samples
AnimationTrack.Looped = true
Priority
Enum.AnimationPriority
์ฌ๋ฌ ์ ๋๋ฉ์ด์ ์ด ๋์์ ์คํ๋ ๋ ์ด๋ค ๋์์ด ์ฐ์๋ฅผ ์ฐจ์งํ ์ง ์ง์ ํ๋ ์์ฑ์ ๋๋ค.
Enum.AnimationPriority๋ ์ด 7๋จ๊ณ๋ก ๊ตฌ๋ถ๋๋ฉฐ, ๊ฐ์ฅ ๋์ Action4๋ถํฐ ๊ฐ์ฅ ๋ฎ์ Core๊น์ง ์ธ๋ถํ๋์ด ์์ต๋๋ค. ์ ๋๋ฉ์ด์ ์ ์ฐ์ ์์๋ฅผ ์ ์ ํ ์ค์ ํ๋ฉด, ์๋ก ๋ค๋ฅธ ์ ๋๋ฉ์ด์ ์ด ํ ๋ฒ์ ์คํ๋๋๋ผ๋ ๋ถ๋๋ฝ๊ฒ ์กฐํ๋ฉ๋๋ค.
์๋ฅผ ๋ค์ด AnimationTrack์ Priority๋ฅผ Movement๋ก ์ง์ ํ๋ฉด ์ด๋ ๋์์ด ๋ฐ์ํ ๊ฒฝ์ฐ ์ ๋๋ฉ์ด์ ์ด ์ฆ์ ์ค๋จ๋ฉ๋๋ค. ๋ฐ๋ฉด Priority๋ฅผ Action์ผ๋ก ์ค์ ํ๋ฉด ์ด๋ ์ค์๋ ์ ๋๋ฉ์ด์ ์ด ๊ณ์ ์ฌ์๋ฉ๋๋ค.
๊ธฐ๋ณธ๊ฐ์ Action์ ๋๋ค.
Code Samples
AnimationTrack.Priority = Enum.AnimationPriority.Movement
AnimationTrack:Play()
Speed
number
ํ์ฌ ์ง์๋์ง ์์ต๋๋ค.
Code Samples
TimePosition
number
ํ์ฌ ์ง์๋์ง ์์ต๋๋ค.
Code Samples
WeightCurrent
number
ํ์ฌ ์ง์๋์ง ์์ต๋๋ค.
Code Samples
WeightTarget
number
ํ์ฌ ์ง์๋์ง ์์ต๋๋ค.
Code Samples
Methods
AdjustSpeed
์ ๋๋ฉ์ด์ ์ ์ฌ์ ์๋๋ฅผ ์ ์ดํฉ๋๋ค.
์ ๋๋ฉ์ด์ ์ ๊ธฐ๋ณธ ์๋๋ AnimationTrack:Play() ์คํ ์ ์ง์ ๋์ง๋ง, ์ฌ์ ๋์ค์๋ ๋ณ๋๋ก ์์ ์ด ๊ฐ๋ฅํฉ๋๋ค.
Parameters
number
InSpeed
์ฌ์ ์๋์ ๋๋ค.
Return
void
Code Samples
AnimationTrack:AdjustSpeed(3)
AdjustWeight
Parameters
number
InWeight
number
InFadeTime
Return
void
Code Samples
GetMarkerReachedSignal
์ ๋๋ฉ์ด์ ์ฌ์ ์ค ํน์ ํคํ๋ ์์ ์ง์ ๋ ๋ง์ปค์ ๋๋ฌํ๋ฉด ์คํ๋๋ ์ด๋ฒคํธ๋ฅผ ๋ฐํํฉ๋๋ค.
Parameters
string
InName
๋ง์ปค์ ์ด๋ฆ์ ๋๋ค.
Return
ScriptSignal
๋ฐํ๋ ์ด๋ฒคํธ์ ๋๋ค.
Code Samples
local function OnAnimationEvent()
print("OnAnimationEvent")
end
AnimationTrack:GetMarkerReachedSignal("SomeKeyName"):connect(OnAnimationEvent)
GetTimeOfKeyframe
ํ์ฌ ์ง์๋์ง ์์ต๋๋ค.
Parameters
string
InName
Return
number
Code Samples
Play
์ ๋๋ฉ์ด์ ํธ๋์ ์คํํฉ๋๋ค.
InFadeTime์ ์ ๋๋ฉ์ด์ ์ด ์ฌ์๋ ๋ ๊ฐ์ค์น๊ฐ ์์ํ ์ฆ๊ฐํ๋ ๋ฐ ๊ฑธ๋ฆฌ๋ ์๊ฐ์ ์กฐ์ ํ์ฌ ์ ์ง์ ์ธ ์ ํ ํจ๊ณผ๋ฅผ ์ ๊ณตํฉ๋๋ค.
InSpeed๋ ์ ๋๋ฉ์ด์ ์ ์ฌ์ ์๋๋ฅผ ๋ฐฐ์จ๋ก ์กฐ์ ํ์ฌ ๊ธฐ๋ณธ ์๋๋ณด๋ค ๋น ๋ฅด๊ฑฐ๋ ๋๋ฆฌ๊ฒ ์คํ๋๋๋ก ์ค์ ํ ์ ์์ต๋๋ค.
Parameters
number
InFadeTime
์ ๋๋ฉ์ด์ ์ ๊ฐ์ค์น๊ฐ ์ฆ๊ฐํ๋ ๋ฐ ๊ฑธ๋ฆฌ๋ ์๊ฐ์ ๋๋ค. (๊ธฐ๋ณธ๊ฐ์ 0.1์ ๋๋ค.)
number
InWeight
ํ์ฌ ์ง์๋์ง ์์ต๋๋ค.
number
InSpeed
์ฌ์ ์๋์ ๋๋ค. (๊ธฐ๋ณธ๊ฐ์ 1์ ๋๋ค.)
Return
void
Code Samples
local Players = game:GetService("Players")
local Character = Players.LocalPlayer.Character
local Humanoid = Character:WaitForChild("Humanoid")
local Animation = Instance.new("Animation")
Animation.AnimationId = "ovdrassetid://18850100" -- WinAnimation01
local Animator = Humanoid:FindFirstChild("Animator")
local AnimationTrack = Animator:LoadAnimation(Animation)
AnimationTrack:Play()
Stop
์คํ์ค์ธ ์ ๋๋ฉ์ด์ ํธ๋์ ์ ์งํฉ๋๋ค.
Parameters
number
InFadeTime
ํ์ฌ ์ง์๋์ง ์์ต๋๋ค.
Return
void
Code Samples
AnimationTrack:Stop()
Events
DidLoop
๋ฃจํ ๊ธฐ๋ฅ์ด ํ์ฑํ๋ ์ ๋๋ฉ์ด์ ํธ๋์ด ๋ฃจํ๋ฅผ ๋ง์น ๋๋ง๋ค ์คํ๋๋ ์ด๋ฒคํธ์ ๋๋ค.
๋ฃจํ๊ฐ ๋๋ ์งํ ๋ค์ ์ ๋ฐ์ดํธ์์ ๋ฐ์ํ๋ฉฐ, ๋ฃจํ๊ฐ ์๋ ์ ๋๋ฉ์ด์ ์๋ ํธ์ถ๋์ง ์์ต๋๋ค.
Parameters
Code Samples
AnimationTrack.Looped = true
local function OnLoopAnimation()
print("The animation looped!")
end
AnimationTrack.DidLoop:Connect(OnLoopAnimation)
AnimationTrack:Play()
Ended
์ ๋๋ฉ์ด์ ํธ๋์ ์ฌ์์ด ์๋ฃ๋๋ฉด ์คํ๋๋ ์ด๋ฒคํธ์ ๋๋ค.
๋ฃจํ ๊ธฐ๋ฅ์ด ํ์ฑํ๋์ด ์์ผ๋ฉด ํธ์ถ๋์ง ์์ผ๋ฉฐ, Stop() ๋ฉ์๋์ ์ํด ์ข ๋ฃ๋ ๋๋ ํธ์ถ๋ฉ๋๋ค.
Parameters
Code Samples
local function OnEnded()
print("The animation has ended!")
end
AnimationTrack.Ended:Connect(OnEnded)
KeyframeReached
(Deprecated) ์ ๋๋ฉ์ด์ ์ด ์งํ๋๋ฉด์ ์ง์ ๋ ์ด๋ฆ์ ๊ฐ์ง ํคํ๋ ์์ ๋๋ฌํ ๋๋ง๋ค ์คํ๋๋ ์ด๋ฒคํธ์ ๋๋ค.
GetMarkerReachedSignal ์ฌ์ฉ์ ๊ถ์ฅํฉ๋๋ค.
Parameters
string
KeyframeName
ํคํ๋ ์ ์ด๋ฆ์ ๋๋ค.
Code Samples
local function OnKeyframeReached(keyframeName)
print(keyframeName)
end
AnimationTrack.KeyframeReached:Connect(OnKeyframeReached)
Stopped
Stop() ๋ฉ์๋์ ์ํด ์ข ๋ฃ๋ ๋ ์ ๋๋ฉ์ด์ ํธ๋์ ์ฌ์์ด ์ ์ง๋๋ฉด ์คํ๋๋ ์ด๋ฒคํธ์ ๋๋ค.
Parameters
Code Samples
local function OnStopped()
print("The animation has been stopped!")
end
AnimationTrack.Stopped:Connect(OnStopped)
See also
์บ๋ฆญํฐ ์ ๋๋ฉ์ด์
Last updated