Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
AnimationNodeTransition
繼承: AnimationNodeSync < AnimationNode < Resource < RefCounted < Object
AnimationTree 中連接兩個 AnimationNode 的過渡。
說明
Simple state machine for cases which don't require a more advanced AnimationNodeStateMachine. Animations can be connected to the inputs and transition times can be specified.
After setting the request and changing the animation playback, the transition node automatically clears the request on the next process frame by setting its transition_request value to empty.
Note: When using a cross-fade, current_state and current_index change to the next state immediately after the cross-fade begins.
# Play child animation connected to "state_2" port.
animation_tree.set("parameters/Transition/transition_request", "state_2")
# Alternative syntax (same result as above).
animation_tree["parameters/Transition/transition_request"] = "state_2"
# Get current state name (read-only).
animation_tree.get("parameters/Transition/current_state")
# Alternative syntax (same result as above).
animation_tree["parameters/Transition/current_state"]
# Get current state index (read-only).
animation_tree.get("parameters/Transition/current_index")
# Alternative syntax (same result as above).
animation_tree["parameters/Transition/current_index"]
// Play child animation connected to "state_2" port.
animationTree.Set("parameters/Transition/transition_request", "state_2");
// Get current state name (read-only).
animationTree.Get("parameters/Transition/current_state");
// Get current state index (read-only).
animationTree.Get("parameters/Transition/current_index");
Optionally, signals can be used by setting an AnimationNodeObserverTransition through AnimationTree.
var observer = animation_tree.get("parameters/Transition/observer")
observer.state_started.connect(on_state_started)
var observer = animationTree.Get("parameters/Transition/observer").As<AnimationNodeObserverTransition>();
observer.StateStarted += OnStateStarted;
教學
屬性
|
||
|
||
|
方法
is_input_loop_broken_at_end(input: int) const |
|
is_input_reset(input: int) const |
|
is_input_set_as_auto_advance(input: int) const |
|
void |
set_input_as_auto_advance(input: int, enable: bool) |
void |
set_input_break_loop_at_end(input: int, enable: bool) |
void |
set_input_reset(input: int, enable: bool) |
屬性說明
bool allow_transition_to_self = false 🔗
若為 true,允許過渡到自身狀態;若在輸入啟用了重設選項,動畫將重新開始。若為 false,則過渡到自身狀態時不會有任何效果。
此動畫節點已啟用的輸入埠數量。
決定動畫交叉淡入淡出的緩動方式。若留空則為線性過渡。應為單位 Curve。
各輸入所連接動畫之間的交叉淡入時間(秒)。
注意:AnimationNodeTransition 會在淡入開始後立即將目前狀態切換為下一個狀態。剩餘的精確時間只能由主要動畫推算。當 AnimationNodeOutput 被視為最上游時,xfade_time 不會因下游的 delta 而縮放。另見 AnimationNodeOneShot.fadeout_time。
方法說明
bool is_input_loop_broken_at_end(input: int) const 🔗
返回動畫是否會在迴圈週期結束時中斷迴圈以進行過渡。
bool is_input_reset(input: int) const 🔗
返回當動畫自另一段動畫過渡而來時,該動畫是否會重新開始播放。
bool is_input_set_as_auto_advance(input: int) const 🔗
若指定的 input 索引已啟用自動前進,則回傳 true。
void set_input_as_auto_advance(input: int, enable: bool) 🔗
啟用或停用指定 input 索引的自動前進。啟用後,節點在動畫播放一次後會切換到下一個輸入;若為最後一個輸入,則會循環回第一個。
void set_input_break_loop_at_end(input: int, enable: bool) 🔗
如果為 true,即使動畫設定為循環,也會在本迴圈結束時中斷迴圈以進行轉場。
void set_input_reset(input: int, enable: bool) 🔗
若為 true,過渡至目標動畫時會重新開始播放。