Class reference

AnimationNodeOneShot

Inherits AnimationNodeSync

Plays an animation once in an AnimationNodeBlendTree.

Description

A 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. 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 ONE_SHOT_REQUEST_NONE.

		# 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"]
		
		// 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");
		

Properties

float autorestart_delay = 1.0

The delay after which the automatic restart is triggered, in seconds.

bool break_loop_at_end = false

If true, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.

Curve fadein_curve

Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit Curve.

float fadein_time = 0.0

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.

Curve fadeout_curve

Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit Curve.

float fadeout_time = 0.0

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.

int mix_mode = 0

The blend type.

Constants

ONE_SHOT_REQUEST_NONE = 0

Enum: OneShotRequest

The default state of the request. Nothing is done.

ONE_SHOT_REQUEST_FIRE = 1

Enum: OneShotRequest

The request to play the animation connected to "shot" port.

ONE_SHOT_REQUEST_ABORT = 2

Enum: OneShotRequest

The request to stop the animation connected to "shot" port.

ONE_SHOT_REQUEST_FADE_OUT = 3

Enum: OneShotRequest

The request to fade out the animation connected to "shot" port.

MIX_MODE_ADD = 1

Enum: MixMode

Blends two animations additively. See also AnimationNodeAdd2.

Tutorials

Source revision 4f5b14abade2
Connection interrupted. Reload×

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.