:github_url: hide .. _class_AnimationNodeAnimation: AnimationNodeAnimation ====================== **繼承:** :ref:`AnimationRootNode` **<** :ref:`AnimationNode` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` :ref:`AnimationNodeBlendTree` 的輸入動畫節點。 .. rst-class:: classref-introduction-group 說明 ---- 可加入 :ref:`AnimationNodeBlendTree` 的資源。僅透過 :ref:`animation` 作為單一輸出埠,供其他 :ref:`AnimationNode` 進行動畫混合之輸入使用。 .. rst-class:: classref-introduction-group 教學 ---- - :doc:`使用 AnimationTree <../tutorials/animation/animation_tree>` - `3D 平台跳躍示範 `__ - `第三人稱射擊(TPS)示範 `__ .. rst-class:: classref-reftable-group 屬性 ---- .. table:: :widths: auto +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`advance_on_start` | ``false`` | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`StringName` | :ref:`animation` | ``&""`` | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`LoopMode` | :ref:`loop_mode` | | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`PlayMode` | :ref:`play_mode` | ``0`` | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`start_offset` | | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`stretch_time_scale` | | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`timeline_length` | | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`use_custom_timeline` | ``false`` | +-------------------------------------------------------+---------------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 列舉 ---- .. _enum_AnimationNodeAnimation_PlayMode: .. rst-class:: classref-enumeration enum **PlayMode**: :ref:`🔗` .. _class_AnimationNodeAnimation_constant_PLAY_MODE_FORWARD: .. rst-class:: classref-enumeration-constant :ref:`PlayMode` **PLAY_MODE_FORWARD** = ``0`` 正向播放動畫。 .. _class_AnimationNodeAnimation_constant_PLAY_MODE_BACKWARD: .. rst-class:: classref-enumeration-constant :ref:`PlayMode` **PLAY_MODE_BACKWARD** = ``1`` 反向播放動畫。 .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group 屬性說明 -------- .. _class_AnimationNodeAnimation_property_advance_on_start: .. rst-class:: classref-property :ref:`bool` **advance_on_start** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_advance_on_start**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_advance_on_start**\ (\ ) 若為 ``true``\ ,當收到自開頭播放動畫的請求時,第一幀僅進行處理但不渲染,播放將自下一幀開始。 另請參閱 :ref:`AnimationPlayer.play()` 的注意事項。 .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeAnimation_property_animation: .. rst-class:: classref-property :ref:`StringName` **animation** = ``&""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_animation**\ (\ value\: :ref:`StringName`\ ) - :ref:`StringName` **get_animation**\ (\ ) 要輸出的動畫,必須是 :ref:`AnimationTree.anim_player` 所提供的動畫之一。 .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeAnimation_property_loop_mode: .. rst-class:: classref-property :ref:`LoopMode` **loop_mode** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_loop_mode**\ (\ value\: :ref:`LoopMode`\ ) - :ref:`LoopMode` **get_loop_mode**\ (\ ) 當 :ref:`use_custom_timeline` 為 ``true`` 時,會以此值覆寫原始 :ref:`Animation` 資源的迴圈設定。 \ **注意:** 若 :ref:`Animation.loop_mode` 未設為循環,則 :ref:`Animation.track_set_interpolation_loop_wrap()` 不會生效。若行為不如預期,建議複製該 :ref:`Animation` 資源並調整其迴圈設定。 .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeAnimation_property_play_mode: .. rst-class:: classref-property :ref:`PlayMode` **play_mode** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_play_mode**\ (\ value\: :ref:`PlayMode`\ ) - :ref:`PlayMode` **get_play_mode**\ (\ ) 決定動畫的播放方向。 .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeAnimation_property_start_offset: .. rst-class:: classref-property :ref:`float` **start_offset** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_start_offset**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_start_offset**\ (\ ) 當 :ref:`use_custom_timeline` 為 ``true`` 時,可偏移動畫的起始位置。 這對於在 3D 行走動畫中調整先踏出的腳十分有用。 .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeAnimation_property_stretch_time_scale: .. rst-class:: classref-property :ref:`bool` **stretch_time_scale** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_stretch_time_scale**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_stretching_time_scale**\ (\ ) 若為 ``true``\ ,會縮放時間,使 :ref:`timeline_length` 所設定的長度成為一個循環。 這有助於對齊走路與跑步動畫的週期。 若為 ``false``\ ,則使用原始動畫長度。若你啟用 :ref:`loop_mode` 迴圈,動畫將於 :ref:`timeline_length` 內循環。 .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeAnimation_property_timeline_length: .. rst-class:: classref-property :ref:`float` **timeline_length** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_timeline_length**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_timeline_length**\ (\ ) 當 :ref:`use_custom_timeline` 為 ``true`` 時,可偏移動畫的起始位置。 .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeAnimation_property_use_custom_timeline: .. rst-class:: classref-property :ref:`bool` **use_custom_timeline** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_use_custom_timeline**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_using_custom_timeline**\ (\ ) 若為 ``true``\ ,此 :ref:`AnimationNode` 會輸出以調整部分參數後的 :ref:`Animation` 資源。 .. |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 (無回傳值。)`