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...
AnimationNodeOneShot
繼承: AnimationNodeSync < AnimationNode < Resource < RefCounted < Object
在 AnimationNodeBlendTree 中播放一次動畫。
說明
A resource to add to an AnimationNodeBlendTree. This animation node will execute a sub-animation and return once it finishes. Blend times for fading in and out can be customized, as well as filters.
After setting the request and changing the animation playback, the one-shot node automatically clears the request on the next process frame by setting its request value to ONE_SHOT_REQUEST_NONE.
# Play child animation connected to "shot" port.
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
# Alternative syntax (same result as above).
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE
# Abort child animation connected to "shot" port.
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)
# Alternative syntax (same result as above).
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT
# Abort child animation with fading out connected to "shot" port.
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT)
# Alternative syntax (same result as above).
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT
# Get current state (read-only).
animation_tree.get("parameters/OneShot/active")
# Alternative syntax (same result as above).
animation_tree["parameters/OneShot/active"]
# Get current internal state (read-only).
animation_tree.get("parameters/OneShot/internal_active")
# Alternative syntax (same result as above).
animation_tree["parameters/OneShot/internal_active"]
// Play child animation connected to "shot" port.
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
// Abort child animation connected to "shot" port.
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);
// Abort child animation with fading out connected to "shot" port.
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut);
// Get current state (read-only).
animationTree.Get("parameters/OneShot/active");
// Get current internal state (read-only).
animationTree.Get("parameters/OneShot/internal_active");
Optionally, signals can be used by setting an AnimationNodeObserverOneShot through AnimationTree.
var observer = tree.get("parameters/OneShot/observer")
observer.started.connect(on_one_shot_started)
var observer = animationTree.Get("parameters/OneShot/observer").As<AnimationNodeObserverOneShot>();
observer.Started += OnOneShotStarted;
教學
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
列舉
enum OneShotRequest: 🔗
OneShotRequest ONE_SHOT_REQUEST_NONE = 0
請求的預設狀態,不執行任何操作。
OneShotRequest ONE_SHOT_REQUEST_FIRE = 1
播放連接到「shot」埠之動畫的請求。
OneShotRequest ONE_SHOT_REQUEST_ABORT = 2
停止連接到「shot」埠之動畫的請求。
OneShotRequest ONE_SHOT_REQUEST_FADE_OUT = 3
淡出連接到「shot」埠之動畫的請求。
enum MixMode: 🔗
MixMode MIX_MODE_BLEND = 0
混合兩個動畫。另請參見 AnimationNodeBlend2。
MixMode MIX_MODE_ADD = 1
以加成方式混合兩個動畫。另請參見 AnimationNodeAdd2。
屬性說明
如果為 true,則子動畫在先前中斷後使用重設恢復時,子動畫將會中止。
如果為 true,子動畫結束後會自動重新開始。
換句話說,要開始自動重新啟動,必須使用 ONE_SHOT_REQUEST_FIRE 請求播放一次動畫。ONE_SHOT_REQUEST_ABORT 請求停止自動重新啟動,但它不會停用 autorestart 本身。因此,ONE_SHOT_REQUEST_FIRE 請求將再次開始自動重新啟動。
float autorestart_delay = 1.0 🔗
觸發自動重新啟動的延遲時間,以秒為單位。
float autorestart_random_delay = 0.0 🔗
如果 autorestart 為 true,則介於0和此值之間的隨機附加延遲(以秒為單位)將新增到 autorestart_delay。
bool break_loop_at_end = false 🔗
如果為 true,即使動畫設定為循環,也會在本迴圈結束時中斷迴圈以進行轉場。
決定動畫交叉淡入淡出的緩動方式。若留空則為線性過渡。應為單位 Curve。
淡入持續時間。例如,對長度 5 秒的動畫將此值設為 1.0,會產生從 0 秒開始至 1 秒結束的交叉淡入。
注意: AnimationNodeOneShot 會在淡入結束後才切換目前狀態。
決定動畫交叉淡入淡出的緩動方式。若留空則為線性過渡。應為單位 Curve。
淡出持續時間。例如,對長度 5 秒的動畫將此值設為 1.0,會產生從 4 秒開始至 5 秒結束的交叉淡出。
注意: AnimationNodeOneShot 會在淡出結束後才切換目前狀態。
混合型別。