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 ¶
- type Advanced
- type Any
- type Extension
- func (self *Extension[T]) AsAnimationNode() AnimationNode.Instance
- func (self *Extension[T]) AsAnimationNodeSync() AnimationNodeSync.Instance
- func (self *Extension[T]) AsAnimationNodeTransition() Instance
- func (self *Extension[T]) AsObject() [1]gd.Object
- func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
- func (self *Extension[T]) AsResource() Resource.Instance
- type ID
- type Instance
- func (self Instance) AllowTransitionToSelf() bool
- func (self Instance) AsAnimationNode() AnimationNode.Instance
- func (self Instance) AsAnimationNodeSync() AnimationNodeSync.Instance
- func (self Instance) AsAnimationNodeTransition() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsResource() Resource.Instance
- func (self Instance) ID() ID
- func (self Instance) IsInputLoopBrokenAtEnd(input int) bool
- func (self Instance) IsInputReset(input int) bool
- func (self Instance) IsInputSetAsAutoAdvance(input int) bool
- func (self Instance) SetAllowTransitionToSelf(value bool)
- func (self Instance) SetInputAsAutoAdvance(input int, enable bool)
- func (self Instance) SetInputBreakLoopAtEnd(input int, enable bool)
- func (self Instance) SetInputCount(value int)
- func (self Instance) SetInputReset(input int, enable bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetXfadeCurve(value Curve.Instance)
- func (self Instance) SetXfadeTime(value Float.X)
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) XfadeCurve() Curve.Instance
- func (self Instance) XfadeTime() Float.X
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 Extension ¶
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 (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsResource ¶
type 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.
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 (Instance) AllowTransitionToSelf ¶
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 (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsResource ¶
func (Instance) IsInputLoopBrokenAtEnd ¶
Returns whether the animation breaks the loop at the end of the loop cycle for transition.
func (Instance) IsInputReset ¶
Returns whether the animation restarts when the animation transitions from the other animation.
func (Instance) IsInputSetAsAutoAdvance ¶
Returns true if auto-advance is enabled for the given 'input' index.
func (Instance) SetAllowTransitionToSelf ¶
SetAllowTransitionToSelf sets the property returned by [IsAllowTransitionToSelf].
func (Instance) SetInputAsAutoAdvance ¶
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 ¶
If true, breaks the loop at the end of the loop cycle for transition, even if the animation is looping.
func (Instance) SetInputCount ¶
The number of enabled input ports for this animation node.
func (Instance) SetInputReset ¶
If true, the destination animation is restarted when the animation transitions.
func (Instance) SetXfadeCurve ¶
SetXfadeCurve sets the property returned by [GetXfadeCurve].
func (Instance) SetXfadeTime ¶
SetXfadeTime sets the property returned by [GetXfadeTime].
func (Instance) XfadeCurve ¶
Determines how cross-fading between animations is eased. If empty, the transition will be linear. Should be a unit Curve.
func (Instance) XfadeTime ¶
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.