AnimationNodeOneShot

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

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 OneShotRequestNone.

package main

import (
	"graphics.gd/classdb/AnimationNodeOneShot"
	"graphics.gd/classdb/AnimationTree"
	"graphics.gd/variant/Object"
)

func ExampleAnimationNodeOneShot(tree AnimationTree.Instance) {
	// Play child animation connected to "shot" port.
	Object.Set(tree, "parameters/OneShot/request", AnimationNodeOneShot.OneShotRequestFire)

	// Abort child animation connected to "shot" port.
	Object.Set(tree, "parameters/OneShot/request", AnimationNodeOneShot.OneShotRequestAbort)

	// Abort child animation with fading out connected to "shot" port.
	Object.Set(tree, "parameters/OneShot/request", AnimationNodeOneShot.OneShotRequestFadeOut)

	// Get current state (read-only).
	Object.Get(tree, "parameters/OneShot/active")

	// Get current internal state (read-only).
	Object.Get(tree, "parameters/OneShot/internal_active")
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Advanced

type Advanced = class

Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.

type Any

type Any interface {
	gd.IsClass
	AsAnimationNodeOneShot() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension

func (*Extension[T]) AsAnimationNode

func (self *Extension[T]) AsAnimationNode() AnimationNode.Instance

func (*Extension[T]) AsAnimationNodeOneShot

func (self *Extension[T]) AsAnimationNodeOneShot() Instance

func (*Extension[T]) AsAnimationNodeSync

func (self *Extension[T]) AsAnimationNodeSync() AnimationNodeSync.Instance

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsRefCounted

func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted

func (*Extension[T]) AsResource

func (self *Extension[T]) AsResource() Resource.Instance

type ID

type ID Object.ID

ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Instance

type Instance [1]gdclass.AnimationNodeOneShot

Instance of the class with convieniently typed arguments and results.

var Nil Instance

Nil is a nil/null instance of the class. Equivalent to the zero value.

func New

func New() Instance

func (Instance) AsAnimationNode

func (self Instance) AsAnimationNode() AnimationNode.Instance

func (Instance) AsAnimationNodeOneShot

func (self Instance) AsAnimationNodeOneShot() Instance

func (Instance) AsAnimationNodeSync

func (self Instance) AsAnimationNodeSync() AnimationNodeSync.Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsRefCounted

func (self Instance) AsRefCounted() [1]gd.RefCounted

func (Instance) AsResource

func (self Instance) AsResource() Resource.Instance

func (Instance) Autorestart

func (self Instance) Autorestart() bool

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 OneShotRequestFire request. The OneShotRequestAbort request stops the auto restarting, but it does not disable the Autorestart itself. So, the OneShotRequestFire request will start auto restarting again.

func (Instance) AutorestartDelay

func (self Instance) AutorestartDelay() Float.X

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

func (Instance) AutorestartRandomDelay

func (self Instance) AutorestartRandomDelay() Float.X

If Autorestart is true, a random additional delay (in seconds) between 0 and this value will be added to AutorestartDelay.

func (Instance) BreakLoopAtEnd

func (self Instance) BreakLoopAtEnd() bool

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

func (Instance) FadeinCurve

func (self Instance) FadeinCurve() Curve.Instance

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

func (Instance) FadeinTime

func (self Instance) FadeinTime() Float.X

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.

func (Instance) FadeoutCurve

func (self Instance) FadeoutCurve() Curve.Instance

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

func (Instance) FadeoutTime

func (self Instance) FadeoutTime() Float.X

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.

func (Instance) ID

func (self Instance) ID() ID

func (Instance) MixMode

func (self Instance) MixMode() MixMode

The blend type.

func (Instance) SetAutorestart

func (self Instance) SetAutorestart(value bool)

SetAutorestart sets the property returned by [HasAutorestart].

func (Instance) SetAutorestartDelay

func (self Instance) SetAutorestartDelay(value Float.X)

SetAutorestartDelay sets the property returned by [GetAutorestartDelay].

func (Instance) SetAutorestartRandomDelay

func (self Instance) SetAutorestartRandomDelay(value Float.X)

SetAutorestartRandomDelay sets the property returned by [GetAutorestartRandomDelay].

func (Instance) SetBreakLoopAtEnd

func (self Instance) SetBreakLoopAtEnd(value bool)

SetBreakLoopAtEnd sets the property returned by [IsLoopBrokenAtEnd].

func (Instance) SetFadeinCurve

func (self Instance) SetFadeinCurve(value Curve.Instance)

SetFadeinCurve sets the property returned by [GetFadeinCurve].

func (Instance) SetFadeinTime

func (self Instance) SetFadeinTime(value Float.X)

SetFadeinTime sets the property returned by [GetFadeinTime].

func (Instance) SetFadeoutCurve

func (self Instance) SetFadeoutCurve(value Curve.Instance)

SetFadeoutCurve sets the property returned by [GetFadeoutCurve].

func (Instance) SetFadeoutTime

func (self Instance) SetFadeoutTime(value Float.X)

SetFadeoutTime sets the property returned by [GetFadeoutTime].

func (Instance) SetMixMode

func (self Instance) SetMixMode(value MixMode)

SetMixMode sets the property returned by [GetMixMode].

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type MixMode

type MixMode int //gd:AnimationNodeOneShot.MixMode
const (
	// Blends two animations. See also [AnimationNodeBlend2].
	//
	// [AnimationNodeBlend2]: https://pkg.go.dev/graphics.gd/classdb/AnimationNodeBlend2
	MixModeBlend MixMode = 0
	// Blends two animations additively. See also [AnimationNodeAdd2].
	//
	// [AnimationNodeAdd2]: https://pkg.go.dev/graphics.gd/classdb/AnimationNodeAdd2
	MixModeAdd MixMode = 1
)

type OneShotRequest

type OneShotRequest int //gd:AnimationNodeOneShot.OneShotRequest
const (
	// The default state of the request. Nothing is done.
	OneShotRequestNone OneShotRequest = 0
	// The request to play the animation connected to "shot" port.
	OneShotRequestFire OneShotRequest = 1
	// The request to stop the animation connected to "shot" port.
	OneShotRequestAbort OneShotRequest = 2
	// The request to fade out the animation connected to "shot" port.
	OneShotRequestFadeOut OneShotRequest = 3
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL