Files
godot-docs-l10n/classes/zh_CN/class_animationplayer.rst
Max Hilbrunner 2ba6d25aa9 Revert "Rename zh_CN/zh_TW to zh_Hans/zh_Hant"
This reverts commit 57781dc0bc.
The rename, although in line with what we did in the engine, caused problems with RTD we need to fix (or push for a fix) first.
2025-12-24 07:14:31 +01:00

908 lines
68 KiB
ReStructuredText
Raw 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"``\ 。如果动画库的键为空字符串(称为默认库),则省略正斜杠,与动画库使用相同的键。
\ **AnimationPlayer** 比 :ref:`Tween<class_Tween>` 更适合用于复杂动画,例如不规则计时的动画。如果用动画轨道编辑器比用代码实现更方便,也可以优先于 :ref:`Tween<class_Tween>` 使用。
更新动画的目标属性是在处理帧中进行的。
.. 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:`String<class_String>` | :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` | |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`String<class_String>` | :ref:`autoplay<class_AnimationPlayer_property_autoplay>` | ``""`` |
+--------------------------------------------------+--------------------------------------------------------------------------------------------------------------------+-----------+
| :ref:`String<class_String>` | :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:`PackedStringArray<class_PackedStringArray>` | :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_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:`String<class_String>`\ ) :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:`String<class_String>` **assigned_animation** :ref:`🔗<class_AnimationPlayer_property_assigned_animation>`
.. rst-class:: classref-property-setget
- |void| **set_assigned_animation**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **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:`String<class_String>` **autoplay** = ``""`` :ref:`🔗<class_AnimationPlayer_property_autoplay>`
.. rst-class:: classref-property-setget
- |void| **set_autoplay**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **get_autoplay**\ (\ )
场景加载时要播放的动画名称。
.. rst-class:: classref-item-separator
----
.. _class_AnimationPlayer_property_current_animation:
.. rst-class:: classref-property
:ref:`String<class_String>` **current_animation** = ``""`` :ref:`🔗<class_AnimationPlayer_property_current_animation>`
.. rst-class:: classref-property-setget
- |void| **set_current_animation**\ (\ value\: :ref:`String<class_String>`\ )
- :ref:`String<class_String>` **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**\ (\ )
混合动画的默认时间。范围从 0 到 4096精度为 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:`PackedStringArray<class_PackedStringArray>` **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_playing:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_AnimationPlayer_method_is_playing>`
如果动画目前正在播放,则返回 ``true``\ (即便 :ref:`speed_scale<class_AnimationPlayer_property_speed_scale>` 和/或 ``custom_speed````0``\ )。
.. 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`` 的动画。
这个方法是简写,等价于调用 :ref:`play()<class_AnimationPlayer_method_play>` 时使用 ``custom_speed = -1.0````from_end = true``\ ,所以更多信息请参阅其描述。
.. 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``\ 。
该方法是 :ref:`play_section()<class_AnimationPlayer_method_play_section>` 的简写,等价于 ``custom_speed = -1.0``\ 、\ ``from_end = true``\ ,详见其描述。
.. 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`` 标记结束。
该方法是 :ref:`play_section_with_markers()<class_AnimationPlayer_method_play_section_with_markers>` 的简写,等价于 ``custom_speed = -1.0``\ 、\ ``from_end = true``\ ,详见其描述。
.. 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 (无返回值。)`