: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/AnimationNodeOneShot.xml. .. _class_AnimationNodeOneShot: AnimationNodeOneShot ==================== **Inherits:** :ref:`AnimationNodeSync` **<** :ref:`AnimationNode` **<** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` Plays an animation once in an :ref:`AnimationNodeBlendTree`. .. rst-class:: classref-introduction-group Description ----------- A resource to add to an :ref:`AnimationNodeBlendTree`. This animation node will execute a sub-animation and return once it finishes. Blend times for fading in and out can be customized, as well as filters. After setting the request and changing the animation playback, the one-shot node automatically clears the request on the next process frame by setting its ``request`` value to :ref:`ONE_SHOT_REQUEST_NONE`. .. tabs:: .. code-tab:: gdscript # Play child animation connected to "shot" port. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE) # Alternative syntax (same result as above). animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE # Abort child animation connected to "shot" port. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT) # Alternative syntax (same result as above). animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT # Abort child animation with fading out connected to "shot" port. animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT) # Alternative syntax (same result as above). animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT # Get current state (read-only). animation_tree.get("parameters/OneShot/active") # Alternative syntax (same result as above). animation_tree["parameters/OneShot/active"] # Get current internal state (read-only). animation_tree.get("parameters/OneShot/internal_active") # Alternative syntax (same result as above). animation_tree["parameters/OneShot/internal_active"] .. code-tab:: csharp // Play child animation connected to "shot" port. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire); // Abort child animation connected to "shot" port. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort); // Abort child animation with fading out connected to "shot" port. animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut); // Get current state (read-only). animationTree.Get("parameters/OneShot/active"); // Get current internal state (read-only). animationTree.Get("parameters/OneShot/internal_active"); .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Using AnimationTree <../tutorials/animation/animation_tree>` - `Third Person Shooter (TPS) Demo `__ .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`autorestart` | ``false`` | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`autorestart_delay` | ``1.0`` | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`autorestart_random_delay` | ``0.0`` | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`bool` | :ref:`break_loop_at_end` | ``false`` | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`Curve` | :ref:`fadein_curve` | | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`fadein_time` | ``0.0`` | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`Curve` | :ref:`fadeout_curve` | | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`float` | :ref:`fadeout_time` | ``0.0`` | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ | :ref:`MixMode` | :ref:`mix_mode` | ``0`` | +---------------------------------------------------+-----------------------------------------------------------------------------------------------+-----------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_AnimationNodeOneShot_OneShotRequest: .. rst-class:: classref-enumeration enum **OneShotRequest**: :ref:`🔗` .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_NONE: .. rst-class:: classref-enumeration-constant :ref:`OneShotRequest` **ONE_SHOT_REQUEST_NONE** = ``0`` The default state of the request. Nothing is done. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FIRE: .. rst-class:: classref-enumeration-constant :ref:`OneShotRequest` **ONE_SHOT_REQUEST_FIRE** = ``1`` The request to play the animation connected to "shot" port. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_ABORT: .. rst-class:: classref-enumeration-constant :ref:`OneShotRequest` **ONE_SHOT_REQUEST_ABORT** = ``2`` The request to stop the animation connected to "shot" port. .. _class_AnimationNodeOneShot_constant_ONE_SHOT_REQUEST_FADE_OUT: .. rst-class:: classref-enumeration-constant :ref:`OneShotRequest` **ONE_SHOT_REQUEST_FADE_OUT** = ``3`` The request to fade out the animation connected to "shot" port. .. rst-class:: classref-item-separator ---- .. _enum_AnimationNodeOneShot_MixMode: .. rst-class:: classref-enumeration enum **MixMode**: :ref:`🔗` .. _class_AnimationNodeOneShot_constant_MIX_MODE_BLEND: .. rst-class:: classref-enumeration-constant :ref:`MixMode` **MIX_MODE_BLEND** = ``0`` Blends two animations. See also :ref:`AnimationNodeBlend2`. .. _class_AnimationNodeOneShot_constant_MIX_MODE_ADD: .. rst-class:: classref-enumeration-constant :ref:`MixMode` **MIX_MODE_ADD** = ``1`` Blends two animations additively. See also :ref:`AnimationNodeAdd2`. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_AnimationNodeOneShot_property_autorestart: .. rst-class:: classref-property :ref:`bool` **autorestart** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_autorestart**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **has_autorestart**\ (\ ) If ``true``, the sub-animation will restart automatically after finishing. In other words, to start auto restarting, the animation must be played once with the :ref:`ONE_SHOT_REQUEST_FIRE` request. The :ref:`ONE_SHOT_REQUEST_ABORT` request stops the auto restarting, but it does not disable the :ref:`autorestart` itself. So, the :ref:`ONE_SHOT_REQUEST_FIRE` request will start auto restarting again. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeOneShot_property_autorestart_delay: .. rst-class:: classref-property :ref:`float` **autorestart_delay** = ``1.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_autorestart_delay**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_autorestart_delay**\ (\ ) The delay after which the automatic restart is triggered, in seconds. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeOneShot_property_autorestart_random_delay: .. rst-class:: classref-property :ref:`float` **autorestart_random_delay** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_autorestart_random_delay**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_autorestart_random_delay**\ (\ ) If :ref:`autorestart` is ``true``, a random additional delay (in seconds) between 0 and this value will be added to :ref:`autorestart_delay`. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeOneShot_property_break_loop_at_end: .. rst-class:: classref-property :ref:`bool` **break_loop_at_end** = ``false`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_break_loop_at_end**\ (\ value\: :ref:`bool`\ ) - :ref:`bool` **is_loop_broken_at_end**\ (\ ) 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_AnimationNodeOneShot_property_fadein_curve: .. rst-class:: classref-property :ref:`Curve` **fadein_curve** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_fadein_curve**\ (\ value\: :ref:`Curve`\ ) - :ref:`Curve` **get_fadein_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_AnimationNodeOneShot_property_fadein_time: .. rst-class:: classref-property :ref:`float` **fadein_time** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_fadein_time**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_fadein_time**\ (\ ) The fade-in duration. For example, setting this to ``1.0`` for a 5 second length animation will produce a cross-fade that starts at 0 second and ends at 1 second during the animation. \ **Note:** **AnimationNodeOneShot** transitions the current state after the fading has finished. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeOneShot_property_fadeout_curve: .. rst-class:: classref-property :ref:`Curve` **fadeout_curve** :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_fadeout_curve**\ (\ value\: :ref:`Curve`\ ) - :ref:`Curve` **get_fadeout_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_AnimationNodeOneShot_property_fadeout_time: .. rst-class:: classref-property :ref:`float` **fadeout_time** = ``0.0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_fadeout_time**\ (\ value\: :ref:`float`\ ) - :ref:`float` **get_fadeout_time**\ (\ ) The fade-out duration. For example, setting this to ``1.0`` for a 5 second length animation will produce a cross-fade that starts at 4 second and ends at 5 second during the animation. \ **Note:** **AnimationNodeOneShot** transitions the current state after the fading has finished. .. rst-class:: classref-item-separator ---- .. _class_AnimationNodeOneShot_property_mix_mode: .. rst-class:: classref-property :ref:`MixMode` **mix_mode** = ``0`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_mix_mode**\ (\ value\: :ref:`MixMode`\ ) - :ref:`MixMode` **get_mix_mode**\ (\ ) The blend type. .. |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.)`