AnimationNodeTransition

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

Simple state machine for cases which don't require a more advanced 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.

package main

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

func ExampleAnimationNodeTransition(tree AnimationTree.Instance) {
	// Play child animation connected to "state_2" port.
	Object.Set(tree, "parameters/Transition/transition_request", "state_2")

	// Get current state name (read-only).
	Object.Get(tree, "parameters/Transition/current_state")

	// Get current state index (read-only).
	Object.Get(tree, "parameters/Transition/current_index")
}

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
	AsAnimationNodeTransition() 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]) AsAnimationNodeSync

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

func (*Extension[T]) AsAnimationNodeTransition

func (self *Extension[T]) AsAnimationNodeTransition() 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.AnimationNodeTransition

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) AllowTransitionToSelf

func (self Instance) AllowTransitionToSelf() bool

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.

func (Instance) AsAnimationNode

func (self Instance) AsAnimationNode() AnimationNode.Instance

func (Instance) AsAnimationNodeSync

func (self Instance) AsAnimationNodeSync() AnimationNodeSync.Instance

func (Instance) AsAnimationNodeTransition

func (self Instance) AsAnimationNodeTransition() 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) ID

func (self Instance) ID() ID

func (Instance) IsInputLoopBrokenAtEnd

func (self Instance) IsInputLoopBrokenAtEnd(input int) bool

Returns whether the animation breaks the loop at the end of the loop cycle for transition.

func (Instance) IsInputReset

func (self Instance) IsInputReset(input int) bool

Returns whether the animation restarts when the animation transitions from the other animation.

func (Instance) IsInputSetAsAutoAdvance

func (self Instance) IsInputSetAsAutoAdvance(input int) bool

Returns true if auto-advance is enabled for the given 'input' index.

func (Instance) SetAllowTransitionToSelf

func (self Instance) SetAllowTransitionToSelf(value bool)

SetAllowTransitionToSelf sets the property returned by [IsAllowTransitionToSelf].

func (Instance) SetInputAsAutoAdvance

func (self Instance) SetInputAsAutoAdvance(input int, enable bool)

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.

func (Instance) SetInputBreakLoopAtEnd

func (self Instance) SetInputBreakLoopAtEnd(input int, enable bool)

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

func (Instance) SetInputCount

func (self Instance) SetInputCount(value int)

The number of enabled input ports for this animation node.

func (Instance) SetInputReset

func (self Instance) SetInputReset(input int, enable bool)

If true, the destination animation is restarted when the animation transitions.

func (*Instance) SetObject

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

func (Instance) SetXfadeCurve

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

SetXfadeCurve sets the property returned by [GetXfadeCurve].

func (Instance) SetXfadeTime

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

SetXfadeTime sets the property returned by [GetXfadeTime].

func (Instance) Virtual

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

func (Instance) XfadeCurve

func (self Instance) XfadeCurve() Curve.Instance

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

func (Instance) XfadeTime

func (self Instance) XfadeTime() Float.X

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 AnimationNodeOutput is considered as the most upstream, so the XfadeTime is not scaled depending on the downstream delta. See also AnimationNodeOneShot.FadeoutTime.

Jump to

Keyboard shortcuts

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