Path: blob/master/doc/classes/AnimationNodeOneShot.xml
10277 views
<?xml version="1.0" encoding="UTF-8" ?>1<class name="AnimationNodeOneShot" inherits="AnimationNodeSync" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">2<brief_description>3Plays an animation once in an [AnimationNodeBlendTree].4</brief_description>5<description>6A resource to add to an [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.7After setting the request and changing the animation playback, the one-shot node automatically clears the request on the next process frame by setting its [code]request[/code] value to [constant ONE_SHOT_REQUEST_NONE].8[codeblocks]9[gdscript]10# Play child animation connected to "shot" port.11animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE)12# Alternative syntax (same result as above).13animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FIRE1415# Abort child animation connected to "shot" port.16animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT)17# Alternative syntax (same result as above).18animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_ABORT1920# Abort child animation with fading out connected to "shot" port.21animation_tree.set("parameters/OneShot/request", AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT)22# Alternative syntax (same result as above).23animation_tree["parameters/OneShot/request"] = AnimationNodeOneShot.ONE_SHOT_REQUEST_FADE_OUT2425# Get current state (read-only).26animation_tree.get("parameters/OneShot/active")27# Alternative syntax (same result as above).28animation_tree["parameters/OneShot/active"]2930# Get current internal state (read-only).31animation_tree.get("parameters/OneShot/internal_active")32# Alternative syntax (same result as above).33animation_tree["parameters/OneShot/internal_active"]34[/gdscript]35[csharp]36// Play child animation connected to "shot" port.37animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Fire);3839// Abort child animation connected to "shot" port.40animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.Abort);4142// Abort child animation with fading out connected to "shot" port.43animationTree.Set("parameters/OneShot/request", (int)AnimationNodeOneShot.OneShotRequest.FadeOut);4445// Get current state (read-only).46animationTree.Get("parameters/OneShot/active");4748// Get current internal state (read-only).49animationTree.Get("parameters/OneShot/internal_active");50[/csharp]51[/codeblocks]52</description>53<tutorials>54<link title="Using AnimationTree">$DOCS_URL/tutorials/animation/animation_tree.html</link>55<link title="Third Person Shooter (TPS) Demo">https://godotengine.org/asset-library/asset/2710</link>56</tutorials>57<members>58<member name="autorestart" type="bool" setter="set_autorestart" getter="has_autorestart" default="false">59If [code]true[/code], the sub-animation will restart automatically after finishing.60In other words, to start auto restarting, the animation must be played once with the [constant ONE_SHOT_REQUEST_FIRE] request. The [constant ONE_SHOT_REQUEST_ABORT] request stops the auto restarting, but it does not disable the [member autorestart] itself. So, the [constant ONE_SHOT_REQUEST_FIRE] request will start auto restarting again.61</member>62<member name="autorestart_delay" type="float" setter="set_autorestart_delay" getter="get_autorestart_delay" default="1.0">63The delay after which the automatic restart is triggered, in seconds.64</member>65<member name="autorestart_random_delay" type="float" setter="set_autorestart_random_delay" getter="get_autorestart_random_delay" default="0.0">66If [member autorestart] is [code]true[/code], a random additional delay (in seconds) between 0 and this value will be added to [member autorestart_delay].67</member>68<member name="break_loop_at_end" type="bool" setter="set_break_loop_at_end" getter="is_loop_broken_at_end" default="false">69If [code]true[/code], breaks the loop at the end of the loop cycle for transition, even if the animation is looping.70</member>71<member name="fadein_curve" type="Curve" setter="set_fadein_curve" getter="get_fadein_curve">72Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit [Curve].73</member>74<member name="fadein_time" type="float" setter="set_fadein_time" getter="get_fadein_time" default="0.0">75The fade-in duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a cross-fade that starts at 0 second and ends at 1 second during the animation.76[b]Note:[/b] [AnimationNodeOneShot] transitions the current state after the fading has finished.77</member>78<member name="fadeout_curve" type="Curve" setter="set_fadeout_curve" getter="get_fadeout_curve">79Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit [Curve].80</member>81<member name="fadeout_time" type="float" setter="set_fadeout_time" getter="get_fadeout_time" default="0.0">82The fade-out duration. For example, setting this to [code]1.0[/code] for a 5 second length animation will produce a cross-fade that starts at 4 second and ends at 5 second during the animation.83[b]Note:[/b] [AnimationNodeOneShot] transitions the current state after the fading has finished.84</member>85<member name="mix_mode" type="int" setter="set_mix_mode" getter="get_mix_mode" enum="AnimationNodeOneShot.MixMode" default="0">86The blend type.87</member>88</members>89<constants>90<constant name="ONE_SHOT_REQUEST_NONE" value="0" enum="OneShotRequest">91The default state of the request. Nothing is done.92</constant>93<constant name="ONE_SHOT_REQUEST_FIRE" value="1" enum="OneShotRequest">94The request to play the animation connected to "shot" port.95</constant>96<constant name="ONE_SHOT_REQUEST_ABORT" value="2" enum="OneShotRequest">97The request to stop the animation connected to "shot" port.98</constant>99<constant name="ONE_SHOT_REQUEST_FADE_OUT" value="3" enum="OneShotRequest">100The request to fade out the animation connected to "shot" port.101</constant>102<constant name="MIX_MODE_BLEND" value="0" enum="MixMode">103Blends two animations. See also [AnimationNodeBlend2].104</constant>105<constant name="MIX_MODE_ADD" value="1" enum="MixMode">106Blends two animations additively. See also [AnimationNodeAdd2].107</constant>108</constants>109</class>110111112