:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimationNodeTransition.xml. .. _class_AnimationNodeTransition: AnimationNodeTransition ======================= **Inherits:** :ref:`AnimationNodeSync` **<** :ref:`AnimationNode` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` A transition within an :ref:`AnimationTree` connecting two :ref:`AnimationNode`\ s. .. rst-class:: classref-introduction-group Description ----------- Simple state machine for cases which don't require a more advanced :ref:`AnimationNodeStateMachine`. Animations can be connected to the inputs and transition times can be specified. After setting the request and changing the animation playback, the transition node automatically clears the request on the next process frame by setting its ``transition_request`` value to empty. \ **Note:** When using a cross-fade, ``current_state`` and ``current_index`` change to the next state immediately after the cross-fade begins. .. tabs:: .. code-tab:: gdscript # Play child animation connected to "state_2" port. animation_tree.set("parameters/Transition/transition_request", "state_2") # Alternative syntax (same result as above). animation_tree["parameters/Transition/transition_request"] = "state_2" # Get current state name (read-only). animation_tree.get("parameters/Transition/current_state") # Alternative syntax (same result as above). animation_tree["parameters/Transition/current_state"] # Get current state index (read-only). animation_tree.get("parameters/Transition/current_index") # Alternative syntax (same result as above). animation_tree["parameters/Transition/current_index"] .. code-tab:: csharp // Play child animation connected to "state_2" port. animationTree.Set("parameters/Transition/transition_request", "state_2"); // Get current state name (read-only). animationTree.Get("parameters/Transition/current_state"); // Get current state index (read-only). animationTree.Get("parameters/Transition/current_index"); .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>` - `3D Platformer Demo `__ - `Third Person Shooter (TPS) Demo `__ .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`allow_transition_to_self` | ``false`` | +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ | :ref:`int` | :ref:`input_count` | ``0`` | +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ | :ref:`Curve` | :ref:`xfade_curve` | | +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`xfade_time` | ``0.0`` | +---------------------------+--------------------------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_input_loop_broken_at_end`\ (\ input\: :ref:`int`\ ) |const| | +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_input_reset`\ (\ input\: :ref:`int`\ ) |const| | +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_input_set_as_auto_advance`\ (\ input\: :ref:`int`\ ) |const| | +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_input_as_auto_advance`\ (\ input\: :ref:`int`, enable\: :ref:`bool`\ ) | +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_input_break_loop_at_end`\ (\ input\: :ref:`int`, enable\: :ref:`bool`\ ) | +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_input_reset`\ (\ input\: :ref:`int`, enable\: :ref:`bool`\ ) | +-------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_AnimationNodeTransition_property_allow_transition_to_self: .. rst-class:: classref-property :ref:`bool` **allow_transition_to_self** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_allow_transition_to_self**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_allow_transition_to_self**\ (\ ) If ``true``, allows transition to the self state. When the reset option is enabled in input, the animation is restarted. If ``false``, nothing happens on the transition to the self state. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_property_input_count: .. rst-class:: classref-property :ref:`int` **input_count** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_input_count**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_input_count**\ (\ ) The number of enabled input ports for this animation node. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_property_xfade_curve: .. rst-class:: classref-property :ref:`Curve` **xfade_curve** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_xfade_curve**\ (\ value\: :ref:`Curve`\ ) - :ref:`Curve` **get_xfade_curve**\ (\ ) Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit :ref:`Curve`. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_property_xfade_time: .. rst-class:: classref-property :ref:`float` **xfade_time** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_xfade_time**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_xfade_time**\ (\ ) Cross-fading time (in seconds) between each animation connected to the inputs. \ **Note:** **AnimationNodeTransition** transitions the current state immediately after the start of the fading. The precise remaining time can only be inferred from the main animation. When :ref:`AnimationNodeOutput` is considered as the most upstream, so the :ref:`xfade_time` is not scaled depending on the downstream delta. See also :ref:`AnimationNodeOneShot.fadeout_time`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_AnimationNodeTransition_method_is_input_loop_broken_at_end: .. rst-class:: classref-method :ref:`bool` **is_input_loop_broken_at_end**\ (\ input\: :ref:`int`\ ) |const| :ref:`🔗` Returns whether the animation breaks the loop at the end of the loop cycle for transition. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_method_is_input_reset: .. rst-class:: classref-method :ref:`bool` **is_input_reset**\ (\ input\: :ref:`int`\ ) |const| :ref:`🔗` Returns whether the animation restarts when the animation transitions from the other animation. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_method_is_input_set_as_auto_advance: .. rst-class:: classref-method :ref:`bool` **is_input_set_as_auto_advance**\ (\ input\: :ref:`int`\ ) |const| :ref:`🔗` Returns ``true`` if auto-advance is enabled for the given ``input`` index. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_method_set_input_as_auto_advance: .. rst-class:: classref-method |void| **set_input_as_auto_advance**\ (\ input\: :ref:`int`, enable\: :ref:`bool`\ ) :ref:`🔗` Enables or disables auto-advance for the given ``input`` index. If enabled, state changes to the next input after playing the animation once. If enabled for the last input state, it loops to the first. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_method_set_input_break_loop_at_end: .. rst-class:: classref-method |void| **set_input_break_loop_at_end**\ (\ input\: :ref:`int`, enable\: :ref:`bool`\ ) :ref:`🔗` If ``true``, breaks the loop at the end of the loop cycle for transition, even if the animation is looping. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeTransition_method_set_input_reset: .. rst-class:: classref-method |void| **set_input_reset**\ (\ input\: :ref:`int`, enable\: :ref:`bool`\ ) :ref:`🔗` If ``true``, the destination animation is restarted when the animation transitions. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`