AnimationPlayer

package
v0.0.0-...-7325ca5 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Package AnimationPlayer provides methods for working with AnimationPlayer object instances.

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 AnimationMethodCallMode

type AnimationMethodCallMode = gdclass.AnimationPlayerAnimationMethodCallMode //gd:AnimationPlayer.AnimationMethodCallMode
const (
	AnimationMethodCallDeferred  AnimationMethodCallMode = 0
	AnimationMethodCallImmediate AnimationMethodCallMode = 1
)

type AnimationProcessCallback

type AnimationProcessCallback = gdclass.AnimationPlayerAnimationProcessCallback //gd:AnimationPlayer.AnimationProcessCallback
const (
	AnimationProcessPhysics AnimationProcessCallback = 0
	AnimationProcessIdle    AnimationProcessCallback = 1
	AnimationProcessManual  AnimationProcessCallback = 2
)

type Any

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

type Instance

type Instance [1]gdclass.AnimationPlayer

An animation player is used for general-purpose playback of animations. It contains a dictionary of [AnimationLibrary] resources and custom blend times between animation transitions. Some methods and properties use a single key to reference an animation directly. These keys are formatted as the key for the library, followed by a forward slash, then the key for the animation within the library, for example [code]"movement/run"[/code]. If the library's key is an empty string (known as the default library), the forward slash is omitted, being the same key used by the library. [AnimationPlayer] is better-suited than [Tween] for more complex animations, for example ones with non-trivial timings. It can also be used over [Tween] if the animation track editor is more convenient than doing it in code. Updating the target properties of animations occurs at the process frame.

var Nil Instance

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

func New

func New() Instance

func (Instance) AnimationGetNext

func (self Instance) AnimationGetNext(animation_from string) string

Returns the key of the animation which is queued to play after the [param animation_from] animation.

func (Instance) AnimationSetNext

func (self Instance) AnimationSetNext(animation_from string, animation_to string)

Triggers the [param animation_to] animation when the [param animation_from] animation completes.

func (Instance) AsAnimationMixer

func (self Instance) AsAnimationMixer() AnimationMixer.Instance

func (Instance) AsAnimationPlayer

func (self Instance) AsAnimationPlayer() Instance

func (Instance) AsNode

func (self Instance) AsNode() Node.Instance

func (Instance) AsObject

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

func (Instance) AssignedAnimation

func (self Instance) AssignedAnimation() string

func (Instance) Autoplay

func (self Instance) Autoplay() string

func (Instance) ClearQueue

func (self Instance) ClearQueue()

Clears all queued, unplayed animations.

func (Instance) CurrentAnimation

func (self Instance) CurrentAnimation() string

func (Instance) CurrentAnimationLength

func (self Instance) CurrentAnimationLength() Float.X

func (Instance) CurrentAnimationPosition

func (self Instance) CurrentAnimationPosition() Float.X

func (Instance) GetBlendTime

func (self Instance) GetBlendTime(animation_from string, animation_to string) Float.X

Returns the blend time (in seconds) between two animations, referenced by their keys.

func (Instance) GetMethodCallMode

func (self Instance) GetMethodCallMode() gdclass.AnimationPlayerAnimationMethodCallMode

Returns the call mode used for "Call Method" tracks.

func (Instance) GetPlayingSpeed

func (self Instance) GetPlayingSpeed() Float.X

Returns the actual playing speed of current animation or [code]0[/code] if not playing. This speed is the [member speed_scale] property multiplied by [code]custom_speed[/code] argument specified when calling the [method play] method. Returns a negative value if the current animation is playing backwards.

func (Instance) GetProcessCallback

func (self Instance) GetProcessCallback() gdclass.AnimationPlayerAnimationProcessCallback

Returns the process notification in which to update animations.

func (Instance) GetQueue

func (self Instance) GetQueue() []string

Returns a list of the animation keys that are currently queued to play.

func (Instance) GetRoot

func (self Instance) GetRoot() string

Returns the node which node path references will travel from.

func (Instance) IsPlaying

func (self Instance) IsPlaying() bool

Returns [code]true[/code] if an animation is currently playing (even if [member speed_scale] and/or [code]custom_speed[/code] are [code]0[/code]).

func (Instance) MovieQuitOnFinish

func (self Instance) MovieQuitOnFinish() bool

func (Instance) OnAnimationChanged

func (self Instance) OnAnimationChanged(cb func(old_name string, new_name string))

func (Instance) OnCurrentAnimationChanged

func (self Instance) OnCurrentAnimationChanged(cb func(name string))

func (Instance) Pause

func (self Instance) Pause()

Pauses the currently playing animation. The [member current_animation_position] will be kept and calling [method play] or [method play_backwards] without arguments or with the same animation name as [member assigned_animation] will resume the animation. See also [method stop].

func (Instance) Play

func (self Instance) Play()

Plays the animation with key [param name]. Custom blend times and speed can be set. The [param from_end] option only affects when switching to a new animation track, or if the same track but at the start or end. It does not affect resuming playback that was paused in the middle of an animation. If [param custom_speed] is negative and [param from_end] is [code]true[/code], the animation will play backwards (which is equivalent to calling [method play_backwards]). The [AnimationPlayer] keeps track of its current or last played animation with [member assigned_animation]. If this method is called with that same animation [param name], or with no [param name] parameter, the assigned animation will resume playing if it was paused. [b]Note:[/b] The animation will be updated the next time the [AnimationPlayer] is processed. If other variables are updated at the same time this is called, they may be updated too early. To perform the update immediately, call [code]advance(0)[/code].

func (Instance) PlayBackwards

func (self Instance) PlayBackwards()

Plays the animation with key [param name] in reverse. This method is a shorthand for [method play] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], so see its description for more information.

func (Instance) PlayWithCapture

func (self Instance) PlayWithCapture()

See also [method AnimationMixer.capture]. You can use this method to use more detailed options for capture than those performed by [member playback_auto_capture]. When [member playback_auto_capture] is [code]false[/code], this method is almost the same as the following: [codeblock] capture(name, duration, trans_type, ease_type) play(name, custom_blend, custom_speed, from_end) [/codeblock] If [param name] is blank, it specifies [member assigned_animation]. If [param duration] is a negative value, the duration is set to the interval between the current position and the first key, when [param from_end] is [code]true[/code], uses the interval between the current position and the last key instead. [b]Note:[/b] The [param duration] takes [member speed_scale] into account, but [param custom_speed] does not, because the capture cache is interpolated with the blend result and the result may contain multiple animations.

func (Instance) PlaybackAutoCapture

func (self Instance) PlaybackAutoCapture() bool

func (Instance) PlaybackAutoCaptureDuration

func (self Instance) PlaybackAutoCaptureDuration() Float.X

func (Instance) PlaybackAutoCaptureEaseType

func (self Instance) PlaybackAutoCaptureEaseType() gdclass.TweenEaseType

func (Instance) PlaybackAutoCaptureTransitionType

func (self Instance) PlaybackAutoCaptureTransitionType() gdclass.TweenTransitionType

func (Instance) PlaybackDefaultBlendTime

func (self Instance) PlaybackDefaultBlendTime() Float.X

func (Instance) Queue

func (self Instance) Queue(name string)

Queues an animation for playback once the current animation and all previously queued animations are done. [b]Note:[/b] If a looped animation is currently playing, the queued animation will never play unless the looped animation is stopped somehow.

func (Instance) SeekTo

func (self Instance) SeekTo(seconds Float.X)

Seeks the animation to the [param seconds] point in time (in seconds). If [param update] is [code]true[/code], the animation updates too, otherwise it updates at process time. Events between the current frame and [param seconds] are skipped. If [param update_only] is [code]true[/code], the method / audio / animation playback tracks will not be processed. [b]Note:[/b] Seeking to the end of the animation doesn't emit [signal AnimationMixer.animation_finished]. If you want to skip animation and emit the signal, use [method AnimationMixer.advance].

func (Instance) SetAssignedAnimation

func (self Instance) SetAssignedAnimation(value string)

func (Instance) SetAutoplay

func (self Instance) SetAutoplay(value string)

func (Instance) SetBlendTime

func (self Instance) SetBlendTime(animation_from string, animation_to string, sec Float.X)

Specifies a blend time (in seconds) between two animations, referenced by their keys.

func (Instance) SetCurrentAnimation

func (self Instance) SetCurrentAnimation(value string)

func (Instance) SetMethodCallMode

func (self Instance) SetMethodCallMode(mode gdclass.AnimationPlayerAnimationMethodCallMode)

Sets the call mode used for "Call Method" tracks.

func (Instance) SetMovieQuitOnFinish

func (self Instance) SetMovieQuitOnFinish(value bool)

func (Instance) SetPlaybackAutoCapture

func (self Instance) SetPlaybackAutoCapture(value bool)

func (Instance) SetPlaybackAutoCaptureDuration

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

func (Instance) SetPlaybackAutoCaptureEaseType

func (self Instance) SetPlaybackAutoCaptureEaseType(value gdclass.TweenEaseType)

func (Instance) SetPlaybackAutoCaptureTransitionType

func (self Instance) SetPlaybackAutoCaptureTransitionType(value gdclass.TweenTransitionType)

func (Instance) SetPlaybackDefaultBlendTime

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

func (Instance) SetProcessCallback

func (self Instance) SetProcessCallback(mode gdclass.AnimationPlayerAnimationProcessCallback)

Sets the process notification in which to update animations.

func (Instance) SetRoot

func (self Instance) SetRoot(path string)

Sets the node which node path references will travel from.

func (Instance) SetSpeedScale

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

func (Instance) SpeedScale

func (self Instance) SpeedScale() Float.X

func (Instance) Stop

func (self Instance) Stop()

Stops the currently playing animation. The animation position is reset to [code]0[/code] and the [code]custom_speed[/code] is reset to [code]1.0[/code]. See also [method pause]. If [param keep_state] is [code]true[/code], the animation state is not updated visually. [b]Note:[/b] The method / audio / animation playback tracks will not be processed by this method.

func (*Instance) UnsafePointer

func (self *Instance) UnsafePointer() unsafe.Pointer

func (Instance) Virtual

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

Jump to

Keyboard shortcuts

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