vanilladocs
vanillapunch.com
API / animation/animator

animation/animator

애니메이터. (상태 기계로 스프라이트 클립을 고르고 섞는다)

Animator. (Picks and blends sprite clips with a state machine)

AnimationStateextends Object

짝Counterpart: vanilla-engine AnimationState

애니메이션 상태. (클립 하나를 속도와 되풀이 여부로 튼다)

  • 상태 시간은 들어온 뒤 흐른 초에 속도를 곱해 쌓은 것이다. 정규화 시간은 상태 시간을 클립 길이로 나눈 것이다. (1 이면 한 바퀴)
  • 되풀이는 setLoop 로 정하지 않으면(null) 클립의 isLoop 를 따른다.
  • 클립이 없거나 길이가 0 이면 정규화 시간은 시간이 흐르기 전 0, 흐른 뒤 1 이다.

Animation state. (Plays one clip with a speed and a loop flag)

  • The state time is the seconds since entering, multiplied by the speed and accumulated. The normalized time is the state time divided by the clip length. (1 is one cycle)
  • If the loop is not set with setLoop (null), it follows the clip's isLoop.
  • With no clip or a zero length, the normalized time is 0 before any time passes and 1 after.
예제Example상태에 클립 달고 시간에 맞는 프레임 보기Attach a clip to a state and look up the frame for a time
import { AnimationState, AnimationClip, Rect } from "./build/vanilla.js";

const clip = new AnimationClip();
clip.setFrames([Rect.create(0, 0, 32, 32), Rect.create(32, 0, 32, 32)]);
clip.setDuration(0.5);
clip.setLoop(false);
const state = new AnimationState();
state.setClip(clip);
state.setSpeed(2);
state.setLoop(true);
console.log(state.isLoop(), state.getNormalizedTime(0.75), state.getFrameIndex(0.75));
생성자constructorconstructor()#0.0.8 부터since 0.0.8소스source

생성.

Constructor.

짝Counterpart: vanilla-engine AnimationState.new

메서드methodsetClip(clip)#0.4.0 부터since 0.4.0소스source

클립 설정.

Sets the clip.

clipAnimationClip | null
이 상태에서 쓸 클립. (null 이면 비운다)Clip used in this state. (cleared if null)

짝Counterpart: vanilla-engine AnimationState.set_clip

메서드methodgetClip()#0.4.0 부터since 0.4.0소스source

클립 반환. (없으면 null)

Returns the clip. (null if none)

반환ReturnsAnimationClip | null 이 상태의 클립.Clip of this state.

짝Counterpart: vanilla-engine AnimationState.get_clip

메서드methodsetSpeed(speed)#0.4.0 부터since 0.4.0소스source

재생 속도 설정.

Sets the playback speed.

speednumber
재생 속도. (기본 1, 2 면 두 배로 빠르고 0 이면 멈춘다)Playback speed. (Default 1, 2 plays twice as fast and 0 stops)

짝Counterpart: vanilla-engine AnimationState.set_speed

메서드methodgetSpeed()#0.4.0 부터since 0.4.0소스source

재생 속도 반환.

Get the playback speed.

반환Returnsnumber 재생 속도. (기본 1)Playback speed. (Default 1)

짝Counterpart: vanilla-engine AnimationState.get_speed

메서드methodsetLoop(isLoop)#0.4.0 부터since 0.4.0소스source

되풀이 여부 설정.

Set whether it loops.

isLoopboolean | null
되풀이하면 참. (null 이면 클립의 isLoop 를 따른다, 기본 null)True to loop. (null follows the clip's isLoop, default null)

짝Counterpart: vanilla-engine AnimationState.set_loop

메서드methodisLoop()#0.4.0 부터since 0.4.0소스source

되풀이 여부 반환.

Get whether it loops.

반환Returnsboolean 되풀이하면 참. (setLoop 로 정하지 않았으면 클립의 isLoop, 클립도 없으면 거짓)True if it loops. (The clip's isLoop when not set with setLoop, false when there is no clip either)

짝Counterpart: vanilla-engine AnimationState.is_loop

메서드methodgetDuration()#0.4.0 부터since 0.4.0소스source

한 바퀴 길이 반환.

Get the length of one cycle.

반환Returnsnumber 클립의 지속 시간. (초, 클립이 없으면 0)Duration of the clip. (Seconds, 0 when there is no clip)

짝Counterpart: vanilla-engine AnimationState.get_duration

메서드methodgetNormalizedTime(time)#0.4.0 부터since 0.4.0소스source

정규화 시간 반환.

Get the normalized time.

timenumber
상태 시간. (초, 속도를 곱해 쌓은 것)State time. (Seconds, accumulated with the speed applied)

반환Returnsnumber 상태 시간을 한 바퀴 길이로 나눈 것. (1 이면 한 바퀴, 되풀이하면 1 을 넘어 쌓인다. 길이가 0 이면 시간이 흐르기 전 0, 흐른 뒤 1)State time divided by the length of one cycle. (1 is one cycle, a looping state keeps accumulating past 1. With a zero length, 0 before any time passes and 1 after)

짝Counterpart: vanilla-engine AnimationState.get_normalized_time

메서드methodgetFrameIndex(time)#0.4.0 부터since 0.4.0소스source

프레임 번호 반환.

Get the frame index.

timenumber
상태 시간. (초, 속도를 곱해 쌓은 것)State time. (Seconds, accumulated with the speed applied)

반환Returnsnumber | null 그 시간에 보일 클립 프레임의 번호. (0 부터, 되풀이하면 바퀴마다 처음부터, 아니면 끝 프레임에 머문다. 길이가 0 이면 0, 클립이나 프레임이 없으면 null)Index of the clip frame shown at that time. (From 0, a looping state restarts every cycle, otherwise it stays on the last frame. 0 for a zero length, null when there is no clip or no frames)

짝Counterpart: vanilla-engine AnimationState.get_frame_index

AnimationTransitionextends Object

짝Counterpart: vanilla-engine AnimationTransition

애니메이션 전이. (조건이 맞으면 대상 상태로 넘어가는 상태 사이의 연결)

  • from 이 null 이면 어느 상태에서나(Any State) 넘어간다. to 가 null 이거나 상태 목록 밖이면 쓰지 않는다.
  • 종료 시각(exitTime)은 나가는 상태의 정규화 시간이다. 정해 두면 그 시각을 지나는 갱신에서만 넘어갈 수 있다. 되풀이하는 상태에서 1 보다 작은 종료 시각은 바퀴마다 본다. (0.5 면 1.5, 2.5 에서도) 그 밖은 한 번만 본다.
  • 조건은 모두 맞아야 한다. 종료 시각도 조건도 없는 전이는 쓰지 않는다.
  • 섞는 시간(duration, 초)이 0 보다 크면 그동안 두 상태가 함께 흐르며 가중치가 선형으로 옮겨 간다. (크로스페이드)
  • 어느 상태에서나 넘어가는 전이가 지금 상태로 가는 경우는 canTransitionToSelf 가 참일 때만 탄다. (기본 참, 다시 처음부터 튼다)

Animation transition. (A link between states that moves to the target state when its conditions hold)

  • With a null from, it moves from any state (Any State). A transition whose to is null or outside the state list is not used.
  • The exit time is the normalized time of the leaving state. When set, the transition can only happen on the update that passes that time. For a looping state, an exit time below 1 is checked every cycle (0.5 also at 1.5, 2.5). Otherwise it is checked only once.
  • All conditions must hold. A transition with neither an exit time nor conditions is not used.
  • If the blend time (duration, seconds) is above 0, both states run together for that time while the weight moves linearly. (Crossfade)
  • A transition from any state that leads to the current state is taken only when canTransitionToSelf is true. (Default true, the state restarts from the beginning)
예제Example걷기에서 달리기로 가는 전이Transition from walking to running
import { Animator, AnimationState, AnimationTransition, AnimationConditionMode } from "./build/vanilla.js";

const animator = new Animator();
const walkIndex = animator.addState(new AnimationState());
const runIndex = animator.addState(new AnimationState());
const transition = new AnimationTransition();
transition.setFrom(walkIndex);
transition.setTo(runIndex);
transition.setDuration(0.2);
transition.addCondition("speed", AnimationConditionMode.greater, 3);
animator.addTransition(transition);
const conditions = transition.getConditions();
console.log(transition.getFrom(), transition.getTo(), transition.getExitTime(), conditions[0].mode);
생성자constructorconstructor()#0.0.8 부터since 0.0.8소스source

생성.

Constructor.

짝Counterpart: vanilla-engine AnimationTransition.new

메서드methodsetFrom(from)#0.4.0 부터since 0.4.0소스source

나가는 상태 설정. (Animator.addState 가 돌려준 번호)

Sets the outgoing state. (The number returned by Animator.addState)

fromnumber | null
나가는 상태의 번호. (null 이면 어느 상태에서나, 기본 null)Index of the leaving state. (null means any state, default null)

짝Counterpart: vanilla-engine AnimationTransition.set_from

메서드methodgetFrom()#0.4.0 부터since 0.4.0소스source

나가는 상태 반환.

Returns the outgoing state.

반환Returnsnumber | null 나가는 상태의 번호. 어느 상태에서나 넘어가면 null.Index of the leaving state. null when it moves from any state.

짝Counterpart: vanilla-engine AnimationTransition.get_from

메서드methodsetTo(to)#0.4.0 부터since 0.4.0소스source

들어가는 상태 설정. (Animator.addState 가 돌려준 번호)

Sets the incoming state. (The number returned by Animator.addState)

tonumber | null
들어가는 상태의 번호. (null 이면 비우고, 빈 전이는 쓰지 않는다)Index of the entering state. (null clears it, an empty transition is not used)

짝Counterpart: vanilla-engine AnimationTransition.set_to

메서드methodgetTo()#0.4.0 부터since 0.4.0소스source

들어가는 상태 반환.

Returns the incoming state.

반환Returnsnumber | null 들어가는 상태의 번호. 정하지 않았으면 null.Index of the state to enter. null if not set.

짝Counterpart: vanilla-engine AnimationTransition.get_to

메서드methodsetExitTime(exitTime)#0.4.0 부터since 0.4.0소스source

종료 시각 설정.

Set the exit time.

exitTimenumber | null
나가는 상태의 정규화 시간. (1 이면 한 바퀴 끝, null 이면 종료 시각 없이 조건만 본다, 기본 null)Normalized time of the leaving state. (1 is the end of one cycle, null checks only the conditions without an exit time, default null)

짝Counterpart: vanilla-engine AnimationTransition.set_exit_time

메서드methodgetExitTime()#0.4.0 부터since 0.4.0소스source

종료 시각 반환.

Get the exit time.

반환Returnsnumber | null 종료 시각. (정규화 시간, 없으면 null)Exit time. (Normalized time, null when there is none)

짝Counterpart: vanilla-engine AnimationTransition.get_exit_time

메서드methodsetDuration(duration)#0.4.0 부터since 0.4.0소스source

섞는 시간 설정.

Set the blend time.

durationnumber
두 상태를 섞는 시간. (초, 0 이하이면 바로 넘어간다, 기본 0)Time to blend the two states. (Seconds, 0 or less moves immediately, default 0)

짝Counterpart: vanilla-engine AnimationTransition.set_duration

메서드methodgetDuration()#0.4.0 부터since 0.4.0소스source

섞는 시간 반환.

Get the blend time.

반환Returnsnumber 섞는 시간. (초)Blend time. (Seconds)

짝Counterpart: vanilla-engine AnimationTransition.get_duration

메서드methodsetCanTransitionToSelf(canTransitionToSelf)#0.4.0 부터since 0.4.0소스source

지금 상태로 가는 것을 허락할지 설정.

Set whether moving to the current state is allowed.

canTransitionToSelfboolean
참이면 어느 상태에서나 넘어가는 전이가 지금 상태로도 간다. (기본 참, from 이 정해진 전이에는 쓰지 않는다)True lets a transition from any state also lead to the current state. (Default true, not used by transitions with a set from)

짝Counterpart: vanilla-engine AnimationTransition.set_can_transition_to_self

메서드methodcanTransitionToSelf()#0.4.0 부터since 0.4.0소스source

지금 상태로 가는 것을 허락하는지 반환.

Get whether moving to the current state is allowed.

반환Returnsboolean 어느 상태에서나 넘어가는 전이가 지금 상태로도 가면 참.True if a transition from any state also leads to the current state.

짝Counterpart: vanilla-engine AnimationTransition.can_transition_to_self

메서드methodaddCondition(parameterName, mode, threshold = 0)#0.4.0 부터since 0.4.0소스source

조건 추가.

Add a condition.

parameterNamestring
견줄 매개변수 이름.Name of the parameter to compare.
modestring
견주는 법. (AnimationConditionMode 의 값)How to compare. (A value of AnimationConditionMode)
thresholdnumber
기준 값. (greater, less, equals, notEqual 에서 쓴다, 기본 0)Threshold. (Used by greater, less, equals, notEqual, default 0)

짝Counterpart: vanilla-engine AnimationTransition.add_condition

메서드methodgetConditions()#0.4.0 부터since 0.4.0소스source

조건 목록 반환.

Get the condition list.

반환Returns{ parameterName: string, mode: string, threshold: number }[] 넣은 차례의 조건 목록. (복사본이 아니다)Conditions in the order they were added. (Not a copy)

짝Counterpart: vanilla-engine AnimationTransition.get_conditions

메서드methodisExitTimeReached(state, previousTime, currentTime)#0.4.0 부터since 0.4.0소스source

종료 시각을 지났는지 반환.

Get whether the exit time was passed.

stateAnimationState
나가는 상태.Leaving state.
previousTimenumber
이번 갱신 앞의 상태 시간. (초)State time before this update. (Seconds)
currentTimenumber
이번 갱신 뒤의 상태 시간. (초)State time after this update. (Seconds)

반환Returnsboolean 종료 시각이 없거나, 이번 갱신에서 종료 시각을 지났으면 참. (길이가 0 인 상태는 들어온 뒤 첫 갱신에서 지난다)True if there is no exit time, or this update passed the exit time. (A zero-length state passes it on the first update after entering)

짝Counterpart: vanilla-engine AnimationTransition.is_exit_time_reached

Animatorextends Object

짝Counterpart: vanilla-engine Animator

애니메이터. (상태 기계로 스프라이트 클립을 고르고 섞는다)

  • 처음 더한 상태에서 시작한다. play 로 아무 상태로나 바로 옮길 수 있다.
  • 매개변수는 실수(setFloat), 정수(setInteger), 참 거짓(setBool), 트리거(setTrigger) 넷이다. 같은 이름을 다른 종류로 넣으면 종류째 바꾼다. 트리거는 그 트리거를 조건으로 쓴 전이가 타면 풀린다. (resetTrigger 로 직접 풀 수도 있다)
  • tick 차례: 상태 시간을 흘린다(섞는 중이면 두 상태 모두) → 섞는 중이면 섞는 시간을 다 채웠을 때 다음 상태로 넘어간다 → 섞는 중이 아니면 어느 상태에서나 넘어가는 전이, 지금 상태에서 나가는 전이 차례로 넣은 순서대로 보고 처음 맞는 하나를 탄다. 섞는 동안에는 새 전이를 보지 않는다.
  • 섞는 중의 가중치: 다음 상태가 getTransitionWeight(섞은 시간 / 섞는 시간), 지금 상태가 1 - 그 값이다.
  • 고른 프레임은 getCurrentFrame, getNextFrame 으로 꺼낸다. (클립 프레임 목록의 것, Frame 이나 Rect)

Animator. (Picks and blends sprite clips with a state machine)

  • It starts in the first added state. play moves to any state immediately.
  • There are four parameter kinds: float (setFloat), integer (setInteger), boolean (setBool), and trigger (setTrigger). Setting the same name with another kind replaces the kind. A trigger is cleared when a transition that uses it as a condition is taken. (resetTrigger also clears it)
  • tick order: advance the state time (both states while blending) → while blending, move to the next state once the blend time is filled → when not blending, check transitions from any state, then transitions leaving the current state, each in the order added, and take the first one that holds. No new transition is checked while blending.
  • Weights while blending: the next state gets getTransitionWeight (blended time / blend time) and the current state gets 1 minus that.
  • The chosen frames come from getCurrentFrame and getNextFrame. (Entries of the clip frame list, Frame or Rect)
예제Example속도로 걷기와 달리기를 오가는 애니메이터Animator that switches between walking and running by speed
import { Animator, AnimationState, AnimationTransition, AnimationClip, AnimationConditionMode, Rect } from "./build/vanilla.js";

const walkClip = new AnimationClip();
walkClip.setFrames([Rect.create(0, 0, 32, 32), Rect.create(32, 0, 32, 32)]);
walkClip.setDuration(1);
walkClip.setLoop(true);
const runClip = new AnimationClip();
runClip.setFrames([Rect.create(0, 32, 32, 32), Rect.create(32, 32, 32, 32)]);
runClip.setDuration(0.5);
runClip.setLoop(true);

const animator = new Animator();
const walkState = new AnimationState();
walkState.setClip(walkClip);
const runState = new AnimationState();
runState.setClip(runClip);
const walkIndex = animator.addState(walkState);
const runIndex = animator.addState(runState);
const toRun = new AnimationTransition();
toRun.setFrom(walkIndex);
toRun.setTo(runIndex);
toRun.setDuration(0.25);
toRun.addCondition("speed", AnimationConditionMode.greater, 3);
animator.addTransition(toRun);
const toWalk = new AnimationTransition();
toWalk.setFrom(runIndex);
toWalk.setTo(walkIndex);
toWalk.addCondition("speed", AnimationConditionMode.less, 1);
animator.addTransition(toWalk);

animator.setFloat("speed", 5);
animator.tick(0.125);
console.log(animator.getCurrentStateIndex(), animator.getNextStateIndex(), animator.getTransitionWeight());
animator.tick(0.125);
console.log(animator.getNextStateIndex(), animator.getTransitionWeight());
animator.tick(0.125);
const frame = animator.getCurrentFrame();
console.log(animator.getCurrentStateIndex(), animator.isInTransition(), frame.position.y);
예제Example트리거로 어느 상태에서나(Any State) 넘어가는 피격과 종료 시각으로 돌아오기A trigger-driven hit from any state (Any State), returning by exit time
import { Animator, AnimationState, AnimationTransition, AnimationClip, AnimationConditionMode, Rect } from "./build/vanilla.js";

const createState = (duration, isLoop) => {
	const clip = new AnimationClip();
	clip.setFrames([Rect.create(0, 0, 32, 32), Rect.create(32, 0, 32, 32)]);
	clip.setDuration(duration);
	clip.setLoop(isLoop);
	const state = new AnimationState();
	state.setClip(clip);
	return state;
};

const animator = new Animator();
const idleIndex = animator.addState(createState(1, true));
const runIndex = animator.addState(createState(0.5, true));
const hitIndex = animator.addState(createState(0.5, false));
const toRun = new AnimationTransition();
toRun.setFrom(idleIndex);
toRun.setTo(runIndex);
toRun.addCondition("isRunning", AnimationConditionMode.if);
animator.addTransition(toRun);
const anyToHit = new AnimationTransition();
anyToHit.setTo(hitIndex);
anyToHit.setCanTransitionToSelf(false);
anyToHit.addCondition("hit", AnimationConditionMode.if);
animator.addTransition(anyToHit);
const hitToIdle = new AnimationTransition();
hitToIdle.setFrom(hitIndex);
hitToIdle.setTo(idleIndex);
hitToIdle.setExitTime(1);
animator.addTransition(hitToIdle);

animator.setBool("isRunning", true);
animator.tick(0.1);
console.log(animator.getCurrentStateIndex() === runIndex);
animator.setTrigger("hit");
animator.tick(0.1);
console.log(animator.getCurrentStateIndex() === hitIndex, animator.getTrigger("hit"));

animator.setTrigger("hit");
animator.tick(0.1);
console.log(animator.getCurrentStateIndex() === hitIndex, animator.getTrigger("hit"));
animator.resetTrigger("hit");
animator.setBool("isRunning", false);
animator.tick(0.5);
console.log(animator.getCurrentStateIndex() === idleIndex);
생성자constructorconstructor()#0.0.8 부터since 0.0.8소스source

생성.

Constructor.

짝Counterpart: vanilla-engine Animator.new

메서드methodtick(timeDelta)#0.0.8 부터since 0.0.8소스source

갱신.

Update.

timeDeltanumber
지난 프레임부터의 시간. (초, 상태마다 속도를 곱해 흘린다)Time since the last frame. (Seconds, each state applies its speed)

짝Counterpart: vanilla-engine Animator.tick

메서드methodplay(stateIndex)#0.4.0 부터since 0.4.0소스source

상태 바로 틀기. (섞지 않고 처음부터)

Play a state immediately. (From the beginning, without blending)

stateIndexnumber
틀 상태의 번호. (Animator.addState 가 돌려준 것, 목록 밖이면 무시한다)Index of the state to play. (Returned by Animator.addState, ignored when outside the list)

짝Counterpart: vanilla-engine Animator.play

메서드methodfindTransition(previousTime)#0.4.0 부터since 0.4.0소스source

탈 전이 찾기.

Find the transition to take.

previousTimenumber
이번 갱신 앞의 지금 상태 시간. (초, 종료 시각을 지났는지 볼 때 쓴다)Current state time before this update. (Seconds, used to check whether the exit time was passed)

반환Returnsnumber | null 처음 맞는 전이의 번호. (어느 상태에서나 넘어가는 전이를 먼저, 그다음 지금 상태에서 나가는 전이를 넣은 순서대로 본다, 섞는 중이거나 없으면 null)Index of the first transition that holds. (Transitions from any state are checked first, then transitions leaving the current state, each in the order added. null while blending or when none holds)

짝Counterpart: vanilla-engine Animator.find_transition

메서드methodstartTransition(transitionIndex)#0.4.0 부터since 0.4.0소스source

전이 타기. (조건과 종료 시각은 보지 않는다)

Take a transition. (Conditions and exit time are not checked)

transitionIndexnumber
탈 전이의 번호. (Animator.addTransition 이 돌려준 것, 목록 밖이거나 들어가는 상태가 목록 밖이면 무시한다)Index of the transition to take. (Returned by Animator.addTransition, ignored when outside the list or when the entering state is outside the list)

짝Counterpart: vanilla-engine Animator.start_transition

메서드methodisConditionSatisfied(condition)#0.4.0 부터since 0.4.0소스source

조건이 맞는지 반환.

Get whether a condition holds.

condition{ parameterName: string, mode: string, threshold: number }
볼 조건. (AnimationTransition.getConditions 의 요소)Condition to check. (An entry of AnimationTransition.getConditions)

반환Returnsboolean 지금 매개변수로 조건이 맞으면 참. (매개변수가 없거나 견줄 수 없는 종류면 거짓)True if the condition holds with the current parameters. (False when the parameter is missing or its kind cannot be compared)

짝Counterpart: vanilla-engine Animator.is_condition_satisfied

메서드methodsetFloat(name, value)#0.4.0 부터since 0.4.0소스source

실수 매개변수 설정.

Set a float parameter.

namestring
매개변수 이름.Parameter name.
valuenumber
값. (같은 이름이 있으면 종류째 바꾼다)Value. (Replaces the kind when the same name exists)

짝Counterpart: vanilla-engine Animator.set_float

메서드methodgetFloat(name)#0.4.0 부터since 0.4.0소스source

실수 매개변수 반환.

Get a float parameter.

namestring
매개변수 이름.Parameter name.

반환Returnsnumber 값. (없거나 실수가 아니면 0)Value. (0 when missing or not a float)

짝Counterpart: vanilla-engine Animator.get_float

메서드methodsetInteger(name, value)#0.4.0 부터since 0.4.0소스source

정수 매개변수 설정.

Set an integer parameter.

namestring
매개변수 이름.Parameter name.
valuenumber
값. (소수점 아래는 버린다, 같은 이름이 있으면 종류째 바꾼다)Value. (The fraction is dropped, replaces the kind when the same name exists)

짝Counterpart: vanilla-engine Animator.set_integer

메서드methodgetInteger(name)#0.4.0 부터since 0.4.0소스source

정수 매개변수 반환.

Get an integer parameter.

namestring
매개변수 이름.Parameter name.

반환Returnsnumber 값. (없거나 정수가 아니면 0)Value. (0 when missing or not an integer)

짝Counterpart: vanilla-engine Animator.get_integer

메서드methodsetBool(name, value)#0.4.0 부터since 0.4.0소스source

참 거짓 매개변수 설정.

Set a boolean parameter.

namestring
매개변수 이름.Parameter name.
valueboolean
값. (같은 이름이 있으면 종류째 바꾼다)Value. (Replaces the kind when the same name exists)

짝Counterpart: vanilla-engine Animator.set_bool

메서드methodgetBool(name)#0.4.0 부터since 0.4.0소스source

참 거짓 매개변수 반환.

Get a boolean parameter.

namestring
매개변수 이름.Parameter name.

반환Returnsboolean 값. (없거나 참 거짓이 아니면 거짓)Value. (False when missing or not a boolean)

짝Counterpart: vanilla-engine Animator.get_bool

메서드methodsetTrigger(name)#0.4.0 부터since 0.4.0소스source

트리거 걸기. (그 트리거를 조건으로 쓴 전이가 타면 풀린다)

Set a trigger. (Cleared when a transition that uses it as a condition is taken)

namestring
매개변수 이름. (같은 이름이 있으면 종류째 바꾼다)Parameter name. (Replaces the kind when the same name exists)

짝Counterpart: vanilla-engine Animator.set_trigger

메서드methodresetTrigger(name)#0.4.0 부터since 0.4.0소스source

트리거 풀기.

Clear a trigger.

namestring
매개변수 이름. (같은 이름이 있으면 종류째 바꾼다)Parameter name. (Replaces the kind when the same name exists)

짝Counterpart: vanilla-engine Animator.reset_trigger

메서드methodgetTrigger(name)#0.4.0 부터since 0.4.0소스source

트리거가 걸려 있는지 반환.

Get whether a trigger is set.

namestring
매개변수 이름.Parameter name.

반환Returnsboolean 걸려 있으면 참. (없거나 트리거가 아니면 거짓)True if set. (False when missing or not a trigger)

짝Counterpart: vanilla-engine Animator.get_trigger

메서드methodgetParameters()#0.4.0 부터since 0.4.0소스source

모든 매개변수 반환.

Get all parameters.

반환ReturnsDictionary<string, { type: string, value: number | boolean }> 매개변수 이름과 종류, 값의 딕셔너리. (type 은 float, int, bool, trigger, 복사본이 아니다)Dictionary of parameter names to kinds and values. (type is float, int, bool, trigger, not a copy)

짝Counterpart: vanilla-engine Animator.get_parameters

메서드methodaddState(state)#0.4.0 부터since 0.4.0소스source

상태 추가. (상태 목록의 번호를 돌려준다, 처음 더한 상태에서 시작한다)

Add a state. (Returns its index in the state list, it starts in the first added state)

stateAnimationState
더할 상태.State to add.

반환Returnsnumber 더한 상태의 번호. (0 부터)Index of the added state. (from 0)

짝Counterpart: vanilla-engine Animator.add_state

메서드methodgetStates()#0.4.0 부터since 0.4.0소스source

상태 목록 반환.

Returns the state list.

반환ReturnsList<AnimationState> 상태 목록. (복사본이 아니다)List of states. (not a copy)

짝Counterpart: vanilla-engine Animator.get_states

메서드methodaddTransition(transition)#0.4.0 부터since 0.4.0소스source

전이 추가. (전이 목록의 번호를 돌려준다)

Add a transition. (Returns its index in the transition list)

transitionAnimationTransition
더할 전이.Transition to add.

반환Returnsnumber 더한 전이의 번호. (0 부터)Index of the added transition. (From 0)

짝Counterpart: vanilla-engine Animator.add_transition

메서드methodgetTransitions()#0.4.0 부터since 0.4.0소스source

전이 목록 반환.

Get the transition list.

반환ReturnsList<AnimationTransition> 전이 목록. (복사본이 아니다)Transition list. (Not a copy)

짝Counterpart: vanilla-engine Animator.get_transitions

메서드methodgetCurrentStateIndex()#0.4.0 부터since 0.4.0소스source

지금 상태 반환.

Get the current state.

반환Returnsnumber | null 지금 상태의 번호. (섞는 중이면 나가는 상태, 상태가 없으면 null)Index of the current state. (The leaving state while blending, null when there are no states)

짝Counterpart: vanilla-engine Animator.get_current_state_index

메서드methodgetCurrentNormalizedTime()#0.4.0 부터since 0.4.0소스source

지금 상태의 정규화 시간 반환.

Get the normalized time of the current state.

반환Returnsnumber 지금 상태 시간을 한 바퀴 길이로 나눈 것. (상태가 없으면 0)Current state time divided by the length of one cycle. (0 when there are no states)

짝Counterpart: vanilla-engine Animator.get_current_normalized_time

메서드methodgetCurrentFrame()#0.4.0 부터since 0.4.0소스source

지금 상태의 프레임 반환.

Get the frame of the current state.

반환ReturnsFrame | Rect | null 지금 상태 시간에 보일 클립 프레임. (클립 프레임 목록의 것, 상태나 클립이나 프레임이 없으면 null)Clip frame shown at the current state time. (An entry of the clip frame list, null when there is no state, clip, or frame)

짝Counterpart: vanilla-engine Animator.get_current_frame

메서드methodisInTransition()#0.4.0 부터since 0.4.0소스source

섞는 중인지 반환.

Get whether it is blending.

반환Returnsboolean 두 상태를 섞는 중이면 참.True while blending two states.

짝Counterpart: vanilla-engine Animator.is_in_transition

메서드methodgetNextStateIndex()#0.4.0 부터since 0.4.0소스source

섞으며 들어가는 상태 반환.

Get the state being blended in.

반환Returnsnumber | null 들어가는 상태의 번호. (섞는 중이 아니면 null)Index of the entering state. (null when not blending)

짝Counterpart: vanilla-engine Animator.get_next_state_index

메서드methodgetNextNormalizedTime()#0.4.0 부터since 0.4.0소스source

들어가는 상태의 정규화 시간 반환.

Get the normalized time of the entering state.

반환Returnsnumber 들어가는 상태 시간을 한 바퀴 길이로 나눈 것. (섞는 중이 아니면 0)Entering state time divided by the length of one cycle. (0 when not blending)

짝Counterpart: vanilla-engine Animator.get_next_normalized_time

메서드methodgetNextFrame()#0.4.0 부터since 0.4.0소스source

들어가는 상태의 프레임 반환.

Get the frame of the entering state.

반환ReturnsFrame | Rect | null 들어가는 상태 시간에 보일 클립 프레임. (섞는 중이 아니거나 클립이나 프레임이 없으면 null)Clip frame shown at the entering state time. (null when not blending or when there is no clip or frame)

짝Counterpart: vanilla-engine Animator.get_next_frame

메서드methodgetTransitionWeight()#0.4.0 부터since 0.4.0소스source

들어가는 상태의 가중치 반환. (크로스페이드)

Get the weight of the entering state. (Crossfade)

반환Returnsnumber 섞은 시간 / 섞는 시간. (0 ~ 1, 지금 상태의 가중치는 1 - 이 값, 섞는 중이 아니면 0)Blended time / blend time. (0 to 1, the current state's weight is 1 minus this, 0 when not blending)

짝Counterpart: vanilla-engine Animator.get_transition_weight

AnimationConditionModeenum

짝Counterpart: vanilla-engine AnimationConditionMode

전이 조건의 견주는 법.

  • if, ifNot 은 참 거짓 매개변수를 본다. (if 는 트리거가 걸려 있는 것도 본다)
  • greater, less, equals, notEqual 은 실수와 정수 매개변수를 기준 값과 견준다.

How a transition condition compares.

  • if and ifNot look at boolean parameters. (if also looks at whether a trigger is set)
  • greater, less, equals, notEqual compare float and integer parameters with the threshold.
이름Name값Value설명Description
ifif참 거짓 매개변수가 참이거나 트리거가 걸려 있다.The boolean parameter is true or the trigger is set.
ifNotifNot참 거짓 매개변수가 거짓이다.The boolean parameter is false.
greatergreater수 매개변수가 기준 값보다 크다.The number parameter is greater than the threshold.
lessless수 매개변수가 기준 값보다 작다.The number parameter is less than the threshold.
equalsequals수 매개변수가 기준 값과 같다.The number parameter equals the threshold.
notEqualnotEqual수 매개변수가 기준 값과 다르다.The number parameter differs from the threshold.