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 中播放一次動畫。
說明
新增到 AnimationNodeBlendTree 的資源。這個動畫節點將執行子動畫並在完成後返回。可以自訂淡入和淡出的混合時間以及篩檢程式。
在設定請求並更改動畫播放後,一次性節點會在下一個處理影格中通過將其 request 值設定為 ONE_SHOT_REQUEST_NONE 來自動清除請求。
# 播放連接到 “shot” 埠的子動畫。
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)
# 替代語法(與上述結果相同)。
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE
# 中止連接到 “shot” 埠的子動畫。
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)
# 替代語法(與上述結果相同)。
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT
# 使用淡出的方法中止連接到 “shot”埠的子動畫。
animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT)
# 替代語法(與上述結果相同)。
animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT
# 獲取目前狀態(唯讀)。
animation_tree.get("parameters/OneShot/active"))
# 替代語法(與上述結果相同)。
animation_tree["parameters/OneShot/active"]
# 獲取目前內部狀態(唯讀)。
animation_tree.get("parameters/OneShot/internal_active")
# 替代語法(與上述結果相同)。
animation_tree["parameters/OneShot/internal_active"]
// 播放連接到 “shot” 埠的子動畫。
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);
// 中止連接到 “shot” 埠的子動畫。
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);
// 使用淡出的方法中止連接到 “shot”埠的子動畫。
animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut);
// 獲取目前狀態(唯讀)。
animationTree.Get("parameters/OneShot/active");
// 獲取目前內部狀態(唯讀)。
animationTree.Get("parameters/OneShot/internal_active");
教學
屬性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
列舉
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。
屬性說明
If true, the sub-animation will abort if resumed with a reset after a prior interruption.
如果為 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 會在淡出結束後才切換目前狀態。
混合型別。