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.

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"]

教學

屬性

bool

abort_on_reset

false

bool

autorestart

false

float

autorestart_delay

1.0

float

autorestart_random_delay

0.0

bool

break_loop_at_end

false

Curve

fadein_curve

float

fadein_time

0.0

Curve

fadeout_curve

float

fadeout_time

0.0

MixMode

mix_mode

0


列舉

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


屬性說明

bool abort_on_reset = false 🔗

  • void set_abort_on_reset(value: bool)

  • bool is_aborted_on_reset()

If true, the sub-animation will abort if resumed with a reset after a prior interruption.


bool autorestart = false 🔗

  • void set_autorestart(value: bool)

  • bool has_autorestart()

如果為 true,子動畫結束後會自動重新開始。

換句話說,要開始自動重啟,必須使用 ONE_SHOT_REQUEST_FIRE 請求播放一次動畫。ONE_SHOT_REQUEST_ABORT 請求停止自動重啟,但它不會禁用 autorestart 本身。因此,ONE_SHOT_REQUEST_FIRE 請求將再次開始自動重啟。


float autorestart_delay = 1.0 🔗

  • void set_autorestart_delay(value: float)

  • float get_autorestart_delay()

觸發自動重啟的延遲時間,以秒為單位。


float autorestart_random_delay = 0.0 🔗

  • void set_autorestart_random_delay(value: float)

  • float get_autorestart_random_delay()

如果 autorestarttrue,則介於0和此值之間的隨機附加延遲(以秒為單位)將新增到 autorestart_delay


bool break_loop_at_end = false 🔗

  • void set_break_loop_at_end(value: bool)

  • bool is_loop_broken_at_end()

如果為 true,即使動畫設定為循環,也會在本迴圈結束時中斷迴圈以進行轉場。


Curve fadein_curve 🔗

  • void set_fadein_curve(value: Curve)

  • Curve get_fadein_curve()

決定動畫交叉淡入淡出的緩動方式。若留空則為線性過渡。應為單位 Curve


float fadein_time = 0.0 🔗

  • void set_fadein_time(value: float)

  • float get_fadein_time()

淡入持續時間。例如,對長度 5 秒的動畫將此值設為 1.0,會產生從 0 秒開始至 1 秒結束的交叉淡入。

注意: AnimationNodeOneShot 會在淡入結束後才切換目前狀態。


Curve fadeout_curve 🔗

  • void set_fadeout_curve(value: Curve)

  • Curve get_fadeout_curve()

決定動畫交叉淡入淡出的緩動方式。若留空則為線性過渡。應為單位 Curve


float fadeout_time = 0.0 🔗

  • void set_fadeout_time(value: float)

  • float get_fadeout_time()

淡出持續時間。例如,對長度 5 秒的動畫將此值設為 1.0,會產生從 4 秒開始至 5 秒結束的交叉淡出。

注意: AnimationNodeOneShot 會在淡出結束後才切換目前狀態。


MixMode mix_mode = 0 🔗

混合型別。