Files
godot-docs-l10n/classes/zh_Hant/class_animationplayer.rst
Rémi Verschelde c3f2364c10 Sync classref with 4.6 branch
Lots of translations invalidated (fuzzied) as we just synced Weblate.
2025-12-19 16:39:51 +01:00

929 lines
69 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_AnimationPlayer:
AnimationPlayer
===============
**繼承:** :ref:`AnimationMixer<class_AnimationMixer>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
用於動畫播放的節點。
.. rst-class:: classref-introduction-group
說明
----
動畫播放器用於一般目的的動畫播放。它包含一個 :ref:`AnimationLibrary<class_AnimationLibrary>` 資源字典以及動畫轉場的自訂混合時間。
某些方法與屬性會用單一鍵值直接參照動畫,此鍵值格式為「動畫庫鍵值/動畫鍵值」,例如 ``"movement/run"``\ 。若動畫庫鍵值為空字串(預設庫),則省略斜線只寫動畫鍵值。
與 :ref:`Tween<class_Tween>` 相比,\ **AnimationPlayer** 更適合處理時序複雜的動畫;若你偏好使用動畫軌編輯器而非程式碼,也可以選擇 **AnimationPlayer**\ 。
動畫目標屬性的更新發生於處理影格階段。
.. rst-class:: classref-introduction-group
教學
----
- :doc:`2D 精靈動畫 <../tutorials/2d/2d_sprite_animation>`
- :doc:`動畫文件索引 <../tutorials/animation/index>`
- `第三人稱射擊TPS示範 <https://godotengine.org/asset-library/asset/2710>`__
.. rst-class:: classref-reftable-group
屬性
----
.. table::
:widths: auto
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`StringName<class_StringName>` | :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` | |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`StringName<class_StringName>` | :ref:`autoplay<class_AnimationPlayer_property_autoplay>` | ``&""`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`StringName<class_StringName>` | :ref:`current_animation<class_AnimationPlayer_property_current_animation>` | ``&""`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`current_animation_length<class_AnimationPlayer_property_current_animation_length>` | |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`current_animation_position<class_AnimationPlayer_property_current_animation_position>` | |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`movie_quit_on_finish<class_AnimationPlayer_property_movie_quit_on_finish>` | ``false`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`bool<class_bool>` | :ref:`playback_auto_capture<class_AnimationPlayer_property_playback_auto_capture>` | ``true`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`playback_auto_capture_duration<class_AnimationPlayer_property_playback_auto_capture_duration>` | ``-1.0`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`EaseType<enum_Tween_EaseType>` | :ref:`playback_auto_capture_ease_type<class_AnimationPlayer_property_playback_auto_capture_ease_type>` | ``0`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`TransitionType<enum_Tween_TransitionType>` | :ref:`playback_auto_capture_transition_type<class_AnimationPlayer_property_playback_auto_capture_transition_type>` | ``0`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`playback_default_blend_time<class_AnimationPlayer_property_playback_default_blend_time>` | ``0.0`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`float<class_float>` | :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` | ``1.0`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`StringName<class_StringName>` | :ref:`animation_get_next<class_AnimationPlayer_method_animation_get_next>`\ (\ animation_from\: :ref:`StringName<class_StringName>`\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`animation_set_next<class_AnimationPlayer_method_animation_set_next>`\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`clear_queue<class_AnimationPlayer_method_clear_queue>`\ (\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_blend_time<class_AnimationPlayer_method_get_blend_time>`\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` | :ref:`get_method_call_mode<class_AnimationPlayer_method_get_method_call_mode>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_playing_speed<class_AnimationPlayer_method_get_playing_speed>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` | :ref:`get_process_callback<class_AnimationPlayer_method_get_process_callback>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] | :ref:`get_queue<class_AnimationPlayer_method_get_queue>`\ (\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`NodePath<class_NodePath>` | :ref:`get_root<class_AnimationPlayer_method_get_root>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_section_end_time<class_AnimationPlayer_method_get_section_end_time>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_section_start_time<class_AnimationPlayer_method_get_section_start_time>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`has_section<class_AnimationPlayer_method_has_section>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_animation_active<class_AnimationPlayer_method_is_animation_active>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimationPlayer_method_is_playing>`\ (\ ) |const| |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`pause<class_AnimationPlayer_method_pause>`\ (\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play<class_AnimationPlayer_method_play>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section<class_AnimationPlayer_method_play_section>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section_backwards<class_AnimationPlayer_method_play_section_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section_with_markers<class_AnimationPlayer_method_play_section_with_markers>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_section_with_markers_backwards<class_AnimationPlayer_method_play_section_with_markers_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`play_with_capture<class_AnimationPlayer_method_play_with_capture>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", duration\: :ref:`float<class_float>` = -1.0, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false, trans_type\: :ref:`TransitionType<enum_Tween_TransitionType>` = 0, ease_type\: :ref:`EaseType<enum_Tween_EaseType>` = 0\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`queue<class_AnimationPlayer_method_queue>`\ (\ name\: :ref:`StringName<class_StringName>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`reset_section<class_AnimationPlayer_method_reset_section>`\ (\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`seek<class_AnimationPlayer_method_seek>`\ (\ seconds\: :ref:`float<class_float>`, update\: :ref:`bool<class_bool>` = false, update_only\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_blend_time<class_AnimationPlayer_method_set_blend_time>`\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`, sec\: :ref:`float<class_float>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_method_call_mode<class_AnimationPlayer_method_set_method_call_mode>`\ (\ mode\: :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_process_callback<class_AnimationPlayer_method_set_process_callback>`\ (\ mode\: :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_root<class_AnimationPlayer_method_set_root>`\ (\ path\: :ref:`NodePath<class_NodePath>`\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_section<class_AnimationPlayer_method_set_section>`\ (\ start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`set_section_with_markers<class_AnimationPlayer_method_set_section_with_markers>`\ (\ start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &""\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| |void| | :ref:`stop<class_AnimationPlayer_method_stop>`\ (\ keep_state\: :ref:`bool<class_bool>` = false\ ) |
+--------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
訊號
----
.. _class_AnimationPlayer_signal_animation_changed:
.. rst-class:: classref-signal
**animation_changed**\ (\ old_name\: :ref:`StringName<class_StringName>`, new_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_signal_animation_changed>`
當佇列中的動畫於上一段動畫播放完畢後開始播放時發出。另見 :ref:`queue()<class_AnimationPlayer_method_queue>`\ 。
\ **注意:** 若透過 :ref:`play()<class_AnimationPlayer_method_play>`:ref:`AnimationTree<class_AnimationTree>` 切換動畫時不會發出此訊號。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_signal_current_animation_changed:
.. rst-class:: classref-signal
**current_animation_changed**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_signal_current_animation_changed>`
:ref:`current_animation<class_AnimationPlayer_property_current_animation>` 變更時發出。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
列舉
----
.. _enum_AnimationPlayer_AnimationProcessCallback:
.. rst-class:: classref-enumeration
enum **AnimationProcessCallback**: :ref:`🔗<enum_AnimationPlayer_AnimationProcessCallback>`
.. _class_AnimationPlayer_constant_ANIMATION_PROCESS_PHYSICS:
.. rst-class:: classref-enumeration-constant
:ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_PHYSICS** = ``0``
**已棄用:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_PHYSICS>`.
.. _class_AnimationPlayer_constant_ANIMATION_PROCESS_IDLE:
.. rst-class:: classref-enumeration-constant
:ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_IDLE** = ``1``
**已棄用:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_IDLE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_IDLE>`.
.. _class_AnimationPlayer_constant_ANIMATION_PROCESS_MANUAL:
.. rst-class:: classref-enumeration-constant
:ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **ANIMATION_PROCESS_MANUAL** = ``2``
**已棄用:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_PROCESS_MANUAL<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_PROCESS_MANUAL>`.
.. rst-class:: classref-item-separator
----
.. _enum_AnimationPlayer_AnimationMethodCallMode:
.. rst-class:: classref-enumeration
enum **AnimationMethodCallMode**: :ref:`🔗<enum_AnimationPlayer_AnimationMethodCallMode>`
.. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_DEFERRED:
.. rst-class:: classref-enumeration-constant
:ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_DEFERRED** = ``0``
**已棄用:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_DEFERRED<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_DEFERRED>`.
.. _class_AnimationPlayer_constant_ANIMATION_METHOD_CALL_IMMEDIATE:
.. rst-class:: classref-enumeration-constant
:ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **ANIMATION_METHOD_CALL_IMMEDIATE** = ``1``
**已棄用:** See :ref:`AnimationMixer.ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE<class_AnimationMixer_constant_ANIMATION_CALLBACK_MODE_METHOD_IMMEDIATE>`.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
屬性說明
--------
.. _class_AnimationPlayer_property_assigned_animation:
.. rst-class:: classref-property
:ref:`StringName<class_StringName>` **assigned_animation** :ref:`🔗<class_AnimationPlayer_property_assigned_animation>`
.. rst-class:: classref-property-setget
- |void| **set_assigned_animation**\ (\ value\: :ref:`StringName<class_StringName>`\ )
- :ref:`StringName<class_StringName>` **get_assigned_animation**\ (\ )
若正在播放則為目前動畫鍵值,否則為上一次播放的動畫鍵值。設定此屬性會更換動畫,但除非已在播放,否則不會自動開始。另見 :ref:`current_animation<class_AnimationPlayer_property_current_animation>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_autoplay:
.. rst-class:: classref-property
:ref:`StringName<class_StringName>` **autoplay** = ``&""`` :ref:`🔗<class_AnimationPlayer_property_autoplay>`
.. rst-class:: classref-property-setget
- |void| **set_autoplay**\ (\ value\: :ref:`StringName<class_StringName>`\ )
- :ref:`StringName<class_StringName>` **get_autoplay**\ (\ )
場景載入時要播放的動畫鍵名。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_current_animation:
.. rst-class:: classref-property
:ref:`StringName<class_StringName>` **current_animation** = ``&""`` :ref:`🔗<class_AnimationPlayer_property_current_animation>`
.. rst-class:: classref-property-setget
- |void| **set_current_animation**\ (\ value\: :ref:`StringName<class_StringName>`\ )
- :ref:`StringName<class_StringName>` **get_current_animation**\ (\ )
目前正在播放的動畫鍵值。若未播放任何動畫,則為空字串。變更此值不會重新啟動動畫。更多播放方式請參閱 :ref:`play()<class_AnimationPlayer_method_play>`\ 。
\ **注意:** 雖然此屬性會出現在屬性檢視器中,但並非用於編輯,且不會存入場景檔。主要用途是取得當前播放的動畫,以及供動畫播放軌內部使用。詳見 :ref:`Animation<class_Animation>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_current_animation_length:
.. rst-class:: classref-property
:ref:`float<class_float>` **current_animation_length** :ref:`🔗<class_AnimationPlayer_property_current_animation_length>`
.. rst-class:: classref-property-setget
- :ref:`float<class_float>` **get_current_animation_length**\ (\ )
目前播放動畫的長度(秒)。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_current_animation_position:
.. rst-class:: classref-property
:ref:`float<class_float>` **current_animation_position** :ref:`🔗<class_AnimationPlayer_property_current_animation_position>`
.. rst-class:: classref-property-setget
- :ref:`float<class_float>` **get_current_animation_position**\ (\ )
目前播放動畫的位置(秒)。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_movie_quit_on_finish:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **movie_quit_on_finish** = ``false`` :ref:`🔗<class_AnimationPlayer_property_movie_quit_on_finish>`
.. rst-class:: classref-property-setget
- |void| **set_movie_quit_on_finish_enabled**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_movie_quit_on_finish_enabled**\ (\ )
若為 ``true`` 且引擎以 Movie Maker 模式運行(見 :ref:`MovieWriter<class_MovieWriter>`\ ),當此 **AnimationPlayer** 播放完動畫後會立刻呼叫 :ref:`SceneTree.quit()<class_SceneTree_method_quit>` 結束引擎,並輸出訊息。
\ **注意:** 該行為遵循 :ref:`AnimationMixer.animation_finished<class_AnimationMixer_signal_animation_finished>` 的邏輯,若動畫設為循環則不會退出引擎。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_playback_auto_capture:
.. rst-class:: classref-property
:ref:`bool<class_bool>` **playback_auto_capture** = ``true`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture>`
.. rst-class:: classref-property-setget
- |void| **set_auto_capture**\ (\ value\: :ref:`bool<class_bool>`\ )
- :ref:`bool<class_bool>` **is_auto_capture**\ (\ )
若為 ``true``\ ,播放前會自動執行 :ref:`AnimationMixer.capture()<class_AnimationMixer_method_capture>`\ 。等同於以預設參數呼叫 :ref:`play_with_capture()<class_AnimationPlayer_method_play_with_capture>`\ ,而非 :ref:`play()<class_AnimationPlayer_method_play>`\ 。
\ **注意:** 僅當動畫包含捕捉軌道時才會進行捕捉插值。另見 :ref:`Animation.UPDATE_CAPTURE<class_Animation_constant_UPDATE_CAPTURE>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_playback_auto_capture_duration:
.. rst-class:: classref-property
:ref:`float<class_float>` **playback_auto_capture_duration** = ``-1.0`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture_duration>`
.. rst-class:: classref-property-setget
- |void| **set_auto_capture_duration**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_auto_capture_duration**\ (\ )
另見 :ref:`play_with_capture()<class_AnimationPlayer_method_play_with_capture>` 與 :ref:`AnimationMixer.capture()<class_AnimationMixer_method_capture>`\ 。
若 :ref:`playback_auto_capture_duration<class_AnimationPlayer_property_playback_auto_capture_duration>` 為負值,時長將設為目前位置到第一個關鍵影格的區間。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_playback_auto_capture_ease_type:
.. rst-class:: classref-property
:ref:`EaseType<enum_Tween_EaseType>` **playback_auto_capture_ease_type** = ``0`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture_ease_type>`
.. rst-class:: classref-property-setget
- |void| **set_auto_capture_ease_type**\ (\ value\: :ref:`EaseType<enum_Tween_EaseType>`\ )
- :ref:`EaseType<enum_Tween_EaseType>` **get_auto_capture_ease_type**\ (\ )
捕捉插值所使用的緩和型式。另見 :ref:`EaseType<enum_Tween_EaseType>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_playback_auto_capture_transition_type:
.. rst-class:: classref-property
:ref:`TransitionType<enum_Tween_TransitionType>` **playback_auto_capture_transition_type** = ``0`` :ref:`🔗<class_AnimationPlayer_property_playback_auto_capture_transition_type>`
.. rst-class:: classref-property-setget
- |void| **set_auto_capture_transition_type**\ (\ value\: :ref:`TransitionType<enum_Tween_TransitionType>`\ )
- :ref:`TransitionType<enum_Tween_TransitionType>` **get_auto_capture_transition_type**\ (\ )
捕捉插值的轉換型式。另見 :ref:`TransitionType<enum_Tween_TransitionType>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_playback_default_blend_time:
.. rst-class:: classref-property
:ref:`float<class_float>` **playback_default_blend_time** = ``0.0`` :ref:`🔗<class_AnimationPlayer_property_playback_default_blend_time>`
.. rst-class:: classref-property-setget
- |void| **set_default_blend_time**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_default_blend_time**\ (\ )
動畫混合的預設時間,範圍 04096精度 0.01。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_speed_scale:
.. rst-class:: classref-property
:ref:`float<class_float>` **speed_scale** = ``1.0`` :ref:`🔗<class_AnimationPlayer_property_speed_scale>`
.. rst-class:: classref-property-setget
- |void| **set_speed_scale**\ (\ value\: :ref:`float<class_float>`\ )
- :ref:`float<class_float>` **get_speed_scale**\ (\ )
速度倍率。值為 ``1`` 時以正常速度播放;\ ``0.5`` 為半速;\ ``2`` 為兩倍速。
若為負值則反向播放;若為 ``0`` 則動畫停止推進。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法說明
--------
.. _class_AnimationPlayer_method_animation_get_next:
.. rst-class:: classref-method
:ref:`StringName<class_StringName>` **animation_get_next**\ (\ animation_from\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationPlayer_method_animation_get_next>`
回傳排定在 ``animation_from`` 動畫之後播放的動畫鍵值。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_animation_set_next:
.. rst-class:: classref-method
|void| **animation_set_next**\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_method_animation_set_next>`
``animation_from`` 動畫播放完畢時觸發 ``animation_to`` 動畫。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_clear_queue:
.. rst-class:: classref-method
|void| **clear_queue**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_clear_queue>`
清除所有已排隊但尚未播放的動畫。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_blend_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_blend_time**\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_blend_time>`
回傳以鍵值指定的兩段動畫之間的混合時間(秒)。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_method_call_mode:
.. rst-class:: classref-method
:ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>` **get_method_call_mode**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_method_call_mode>`
**已棄用:** Use :ref:`AnimationMixer.callback_mode_method<class_AnimationMixer_property_callback_mode_method>` instead.
回傳「方法呼叫」軌道所使用的呼叫模式。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_playing_speed:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_playing_speed**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_playing_speed>`
回傳目前動畫的實際播放速度,若未播放則為 ``0``\ 。此速度為 :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` 與呼叫 :ref:`play()<class_AnimationPlayer_method_play>` 時指定的 ``custom_speed`` 相乘所得。
若動畫以倒放方式播放,則回傳負值。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_process_callback:
.. rst-class:: classref-method
:ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>` **get_process_callback**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_process_callback>`
**已棄用:** Use :ref:`AnimationMixer.callback_mode_process<class_AnimationMixer_property_callback_mode_process>` instead.
回傳用來更新動畫的處理通知類型。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_queue:
.. rst-class:: classref-method
:ref:`Array<class_Array>`\[:ref:`StringName<class_StringName>`\] **get_queue**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_get_queue>`
回傳目前排程中等待播放的動畫鍵值清單。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_root:
.. rst-class:: classref-method
:ref:`NodePath<class_NodePath>` **get_root**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_root>`
**已棄用:** Use :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>` instead.
回傳節點路徑引用的起始節點。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_section_end_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_section_end_time**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_section_end_time>`
回傳目前播放區段的結束時間。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_get_section_start_time:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_section_start_time**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_get_section_start_time>`
回傳目前播放區段的開始時間。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_has_section:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **has_section**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_has_section>`
若目前有區段動畫在播放則回傳 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_is_animation_active:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_animation_active**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_is_animation_active>`
Returns ``true`` if the an animation is currently active. An animation is active if it was played by calling :ref:`play()<class_AnimationPlayer_method_play>` and was not finished yet, or was stopped by calling :ref:`stop()<class_AnimationPlayer_method_stop>`.
This can be used to check whether an animation is currently paused or stopped.
::
var is_paused = not is_playing() and is_animation_active()
var is_stopped = not is_playing() and not is_animation_active()
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_is_playing:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_is_playing>`
若動畫正在播放(即使 :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>```custom_speed````0``\ ),則回傳 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_pause:
.. rst-class:: classref-method
|void| **pause**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_pause>`
暫停當前播放的動畫。\ :ref:`current_animation_position<class_AnimationPlayer_property_current_animation_position>` 會被保留;呼叫 :ref:`play()<class_AnimationPlayer_method_play>` 或 :ref:`play_backwards()<class_AnimationPlayer_method_play_backwards>` 而不帶參數,或帶與 :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` 相同的動畫名稱,即可繼續播放。
另見 :ref:`stop()<class_AnimationPlayer_method_stop>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play:
.. rst-class:: classref-method
|void| **play**\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_play>`
播放鍵值為 ``name`` 的動畫,可自訂混合時間與播放速度。
\ ``from_end`` 僅影響切換到新動畫軌或同一軌起點/終點時;不影響在動畫中段暫停後再繼續播放。若 ``custom_speed`` 為負且 ``from_end````true``\ ,則動畫將倒放(等同於呼叫 :ref:`play_backwards()<class_AnimationPlayer_method_play_backwards>`\ )。
\ **AnimationPlayer** 會以 :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` 記錄目前或最後播放的動畫。如果此方法使用相同動畫 ``name``\ ,或未帶 ``name`` 參數呼叫,將會在暫停後繼續播放。
\ **注意:** 動畫會在下一次 **AnimationPlayer** 處理時更新。若同時修改其他變數,可能會過早執行。若需立即更新,請呼叫 ``advance(0)``\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_backwards:
.. rst-class:: classref-method
|void| **play_backwards**\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_play_backwards>`
倒放鍵名為 ``name`` 的動畫。
此方法相當於使用 ``custom_speed = -1.0``\ 、\ ``from_end = true`` 呼叫 :ref:`play()<class_AnimationPlayer_method_play>`\ ,詳情請參考該方法說明。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_section:
.. rst-class:: classref-method
|void| **play_section**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_play_section>`
播放鍵值為 ``name`` 的動畫,僅播放從 ``start_time````end_time`` 的區段。詳見 :ref:`play()<class_AnimationPlayer_method_play>`\ 。
``start_time`` 超出動畫範圍,將改用動畫起點;若 ``end_time`` 超出範圍,將改用動畫終點。\ ``start_time`` 不可等於 ``end_time``\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_section_backwards:
.. rst-class:: classref-method
|void| **play_section_backwards**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1, custom_blend\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_play_section_backwards>`
倒播鍵值為 ``name`` 的動畫,僅播放從 ``start_time````end_time`` 的區段。
此方法等同於以 ``custom_speed = -1.0````from_end = true`` 呼叫 :ref:`play_section()<class_AnimationPlayer_method_play_section>`\ ,詳情請參閱其說明。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_section_with_markers:
.. rst-class:: classref-method
|void| **play_section_with_markers**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_play_section_with_markers>`
播放鍵值為 ``name`` 的動畫,區段從 ``start_marker`` 開始至 ``end_marker`` 結束。
若開始標記為空,則從動畫開頭播放;若結束標記為空,則播放至動畫結尾。詳見 :ref:`play()<class_AnimationPlayer_method_play>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_section_with_markers_backwards:
.. rst-class:: classref-method
|void| **play_section_with_markers_backwards**\ (\ name\: :ref:`StringName<class_StringName>` = &"", start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &"", custom_blend\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_play_section_with_markers_backwards>`
倒播鍵值為 ``name`` 的動畫,區段從 ``start_marker`` 開始至 ``end_marker`` 結束。
此方法等同於以 ``custom_speed = -1.0````from_end = true`` 呼叫 :ref:`play_section_with_markers()<class_AnimationPlayer_method_play_section_with_markers>`\ ,詳情請參閱其說明。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_play_with_capture:
.. rst-class:: classref-method
|void| **play_with_capture**\ (\ name\: :ref:`StringName<class_StringName>` = &"", duration\: :ref:`float<class_float>` = -1.0, custom_blend\: :ref:`float<class_float>` = -1, custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false, trans_type\: :ref:`TransitionType<enum_Tween_TransitionType>` = 0, ease_type\: :ref:`EaseType<enum_Tween_EaseType>` = 0\ ) :ref:`🔗<class_AnimationPlayer_method_play_with_capture>`
另見 :ref:`AnimationMixer.capture()<class_AnimationMixer_method_capture>`\ 。
此方法可提供比 :ref:`playback_auto_capture<class_AnimationPlayer_property_playback_auto_capture>` 更細緻的捕捉選項。當 :ref:`playback_auto_capture<class_AnimationPlayer_property_playback_auto_capture>```false`` 時,其行為大致相當於:
::
capture(name, duration, trans_type, ease_type)
play(name, custom_blend, custom_speed, from_end)
``name`` 為空,代表使用 :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>`\ 。
``duration`` 為負,則時長設為目前位置到第一個關鍵影格的區間;若 ``from_end````true``\ ,則改為目前位置到最後一個關鍵影格的區間。
\ **注意:**\ ``duration`` 會考慮 :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>`\ ,但 ``custom_speed`` 不會,因捕捉快取會與混合結果插值,而結果可能包含多段動畫。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_queue:
.. rst-class:: classref-method
|void| **queue**\ (\ name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_AnimationPlayer_method_queue>`
將動畫加入佇列,待目前動畫及先前所有佇列動畫播放完畢後才播放。
\ **注意:** 若目前正在播放循環動畫,除非該動畫被中止,否則佇列動畫永遠不會被播放。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_reset_section:
.. rst-class:: classref-method
|void| **reset_section**\ (\ ) :ref:`🔗<class_AnimationPlayer_method_reset_section>`
若已設定區段則會重設目前區段;若未設定則無任何作用。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_seek:
.. rst-class:: classref-method
|void| **seek**\ (\ seconds\: :ref:`float<class_float>`, update\: :ref:`bool<class_bool>` = false, update_only\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_seek>`
將動畫跳至 ``seconds`` 秒位置。若 ``update````true``\ ,動畫會立即更新;否則將於處理時更新。當前影格到 ``seconds`` 之間的事件會被略過。
``update_only````true``\ ,方法/音訊/動畫播放軌將不會被處理。
\ **注意:** 跳到動畫結尾不會觸發 :ref:`AnimationMixer.animation_finished<class_AnimationMixer_signal_animation_finished>`\ 。若要跳過動畫並觸發訊號,請使用 :ref:`AnimationMixer.advance()<class_AnimationMixer_method_advance>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_set_blend_time:
.. rst-class:: classref-method
|void| **set_blend_time**\ (\ animation_from\: :ref:`StringName<class_StringName>`, animation_to\: :ref:`StringName<class_StringName>`, sec\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_blend_time>`
指定以鍵值參照的兩段動畫之間的混合時間(秒)。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_set_method_call_mode:
.. rst-class:: classref-method
|void| **set_method_call_mode**\ (\ mode\: :ref:`AnimationMethodCallMode<enum_AnimationPlayer_AnimationMethodCallMode>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_method_call_mode>`
**已棄用:** Use :ref:`AnimationMixer.callback_mode_method<class_AnimationMixer_property_callback_mode_method>` instead.
設定「方法呼叫」軌道所使用的呼叫模式。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_set_process_callback:
.. rst-class:: classref-method
|void| **set_process_callback**\ (\ mode\: :ref:`AnimationProcessCallback<enum_AnimationPlayer_AnimationProcessCallback>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_process_callback>`
**已棄用:** Use :ref:`AnimationMixer.callback_mode_process<class_AnimationMixer_property_callback_mode_process>` instead.
設定用於更新動畫的處理通知類型。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_set_root:
.. rst-class:: classref-method
|void| **set_root**\ (\ path\: :ref:`NodePath<class_NodePath>`\ ) :ref:`🔗<class_AnimationPlayer_method_set_root>`
**已棄用:** Use :ref:`AnimationMixer.root_node<class_AnimationMixer_property_root_node>` instead.
設定節點路徑引用的起始節點。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_set_section:
.. rst-class:: classref-method
|void| **set_section**\ (\ start_time\: :ref:`float<class_float>` = -1, end_time\: :ref:`float<class_float>` = -1\ ) :ref:`🔗<class_AnimationPlayer_method_set_section>`
變更正在播放區段的起始與結束時間,當前播放位置會被限制在新區段內。詳見 :ref:`play_section()<class_AnimationPlayer_method_play_section>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_set_section_with_markers:
.. rst-class:: classref-method
|void| **set_section_with_markers**\ (\ start_marker\: :ref:`StringName<class_StringName>` = &"", end_marker\: :ref:`StringName<class_StringName>` = &""\ ) :ref:`🔗<class_AnimationPlayer_method_set_section_with_markers>`
變更正在播放區段的起始與結束標記,當前播放位置會被限制在新區段內。詳見 :ref:`play_section_with_markers()<class_AnimationPlayer_method_play_section_with_markers>`\ 。
若參數為空,區段將使用動畫的開頭或結尾;若兩者皆空,代表未設定區段。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_method_stop:
.. rst-class:: classref-method
|void| **stop**\ (\ keep_state\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimationPlayer_method_stop>`
停止當前播放的動畫,並將動畫位置重設為 ``0``\ 、\ ``custom_speed`` 重設為 ``1.0``\ 。另見 :ref:`pause()<class_AnimationPlayer_method_pause>`\ 。
``keep_state````true``\ ,動畫狀態不會在畫面上更新。
\ **注意:** 方法/音訊/動畫播放軌不會由此方法處理。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要使用者覆寫才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法沒有副作用。不會修改該實例的任何成員變數。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了這裡描述的參數外,還可以接受任意數量的參數。)`
.. |constructor| replace:: :abbr:`constructor (本方法用於建構一個型別。)`
.. |static| replace:: :abbr:`static (本方法無需實例即可呼叫,因此可以直接使用類別名稱呼叫。)`
.. |operator| replace:: :abbr:`operator (本方法描述將本型別作為左運算元時可用的有效運算子。)`
.. |bitfield| replace:: :abbr:`BitField (此值是由下列旗標組成的位元遮罩整數。)`
.. |void| replace:: :abbr:`void (無回傳值。)`