Documentation
¶
Overview ¶
Package AnimationPlayer provides methods for working with AnimationPlayer object instances.
Index ¶
- type Advanced
- type AnimationMethodCallMode
- type AnimationProcessCallback
- type Any
- type Instance
- func (self Instance) AnimationGetNext(animation_from string) string
- func (self Instance) AnimationSetNext(animation_from string, animation_to string)
- func (self Instance) AsAnimationMixer() AnimationMixer.Instance
- func (self Instance) AsAnimationPlayer() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AssignedAnimation() string
- func (self Instance) Autoplay() string
- func (self Instance) ClearQueue()
- func (self Instance) CurrentAnimation() string
- func (self Instance) CurrentAnimationLength() Float.X
- func (self Instance) CurrentAnimationPosition() Float.X
- func (self Instance) GetBlendTime(animation_from string, animation_to string) Float.X
- func (self Instance) GetMethodCallMode() gdclass.AnimationPlayerAnimationMethodCallMode
- func (self Instance) GetPlayingSpeed() Float.X
- func (self Instance) GetProcessCallback() gdclass.AnimationPlayerAnimationProcessCallback
- func (self Instance) GetQueue() []string
- func (self Instance) GetRoot() string
- func (self Instance) GetSectionEndTime() Float.X
- func (self Instance) GetSectionStartTime() Float.X
- func (self Instance) HasSection() bool
- func (self Instance) IsPlaying() bool
- func (self Instance) MovieQuitOnFinish() bool
- func (self Instance) OnAnimationChanged(cb func(old_name string, new_name string))
- func (self Instance) OnCurrentAnimationChanged(cb func(name string))
- func (self Instance) Pause()
- func (self Instance) Play()
- func (self Instance) PlayBackwards()
- func (self Instance) PlayNamed(anim_name string)
- func (self Instance) PlaySection()
- func (self Instance) PlaySectionBackwards()
- func (self Instance) PlaySectionWithMarkers()
- func (self Instance) PlaySectionWithMarkersBackwards()
- func (self Instance) PlayWithCapture()
- func (self Instance) PlaybackAutoCapture() bool
- func (self Instance) PlaybackAutoCaptureDuration() Float.X
- func (self Instance) PlaybackAutoCaptureEaseType() gdclass.TweenEaseType
- func (self Instance) PlaybackAutoCaptureTransitionType() gdclass.TweenTransitionType
- func (self Instance) PlaybackDefaultBlendTime() Float.X
- func (self Instance) Queue(name string)
- func (self Instance) ResetSection()
- func (self Instance) SeekTo(seconds Float.X)
- func (self Instance) SetAssignedAnimation(value string)
- func (self Instance) SetAutoplay(value string)
- func (self Instance) SetBlendTime(animation_from string, animation_to string, sec Float.X)
- func (self Instance) SetCurrentAnimation(value string)
- func (self Instance) SetMethodCallMode(mode gdclass.AnimationPlayerAnimationMethodCallMode)
- func (self Instance) SetMovieQuitOnFinish(value bool)
- func (self Instance) SetPlaybackAutoCapture(value bool)
- func (self Instance) SetPlaybackAutoCaptureDuration(value Float.X)
- func (self Instance) SetPlaybackAutoCaptureEaseType(value gdclass.TweenEaseType)
- func (self Instance) SetPlaybackAutoCaptureTransitionType(value gdclass.TweenTransitionType)
- func (self Instance) SetPlaybackDefaultBlendTime(value Float.X)
- func (self Instance) SetProcessCallback(mode gdclass.AnimationPlayerAnimationProcessCallback)
- func (self Instance) SetRoot(path string)
- func (self Instance) SetSection()
- func (self Instance) SetSectionWithMarkers()
- func (self Instance) SetSpeedScale(value Float.X)
- func (self Instance) SpeedScale() Float.X
- func (self Instance) Stop()
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) Virtual(name string) reflect.Value
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 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 (Instance) AnimationGetNext ¶
Returns the key of the animation which is queued to play after the [param animation_from] animation.
func (Instance) AnimationSetNext ¶
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 (Instance) AssignedAnimation ¶
func (Instance) ClearQueue ¶
func (self Instance) ClearQueue()
Clears all queued, unplayed animations.
func (Instance) CurrentAnimation ¶
func (Instance) CurrentAnimationLength ¶
func (Instance) CurrentAnimationPosition ¶
func (Instance) GetBlendTime ¶
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 ¶
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) GetSectionEndTime ¶
Returns the end time of the section currently being played.
func (Instance) GetSectionStartTime ¶
Returns the start time of the section currently being played.
func (Instance) HasSection ¶
Returns [code]true[/code] if an animation is currently playing with section.
func (Instance) IsPlaying ¶
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 (Instance) OnAnimationChanged ¶
func (Instance) OnCurrentAnimationChanged ¶
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) PlaySection ¶
func (self Instance) PlaySection()
Plays the animation with key [param name] and the section starting from [param start_time] and ending on [param end_time]. See also [method play]. Setting [param start_time] to a value outside the range of the animation means the start of the animation will be used instead, and setting [param end_time] to a value outside the range of the animation means the end of the animation will be used instead. [param start_time] cannot be equal to [param end_time].
func (Instance) PlaySectionBackwards ¶
func (self Instance) PlaySectionBackwards()
Plays the animation with key [param name] and the section starting from [param start_time] and ending on [param end_time] in reverse. This method is a shorthand for [method play_section] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], see its description for more information.
func (Instance) PlaySectionWithMarkers ¶
func (self Instance) PlaySectionWithMarkers()
Plays the animation with key [param name] and the section starting from [param start_marker] and ending on [param end_marker]. If the start marker is empty, the section starts from the beginning of the animation. If the end marker is empty, the section ends on the end of the animation. See also [method play].
func (Instance) PlaySectionWithMarkersBackwards ¶
func (self Instance) PlaySectionWithMarkersBackwards()
Plays the animation with key [param name] and the section starting from [param start_marker] and ending on [param end_marker] in reverse. This method is a shorthand for [method play_section_with_markers] with [code]custom_speed = -1.0[/code] and [code]from_end = true[/code], 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 (Instance) PlaybackAutoCaptureDuration ¶
func (Instance) PlaybackAutoCaptureEaseType ¶
func (self Instance) PlaybackAutoCaptureEaseType() gdclass.TweenEaseType
func (Instance) PlaybackAutoCaptureTransitionType ¶
func (self Instance) PlaybackAutoCaptureTransitionType() gdclass.TweenTransitionType
func (Instance) PlaybackDefaultBlendTime ¶
func (Instance) Queue ¶
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) ResetSection ¶
func (self Instance) ResetSection()
Resets the current section if section is set.
func (Instance) SeekTo ¶
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 (Instance) SetAutoplay ¶
func (Instance) SetBlendTime ¶
Specifies a blend time (in seconds) between two animations, referenced by their keys.
func (Instance) SetCurrentAnimation ¶
func (Instance) SetMethodCallMode ¶
func (self Instance) SetMethodCallMode(mode gdclass.AnimationPlayerAnimationMethodCallMode)
Sets the call mode used for "Call Method" tracks.
func (Instance) SetMovieQuitOnFinish ¶
func (Instance) SetPlaybackAutoCapture ¶
func (Instance) SetPlaybackAutoCaptureDuration ¶
func (Instance) SetPlaybackAutoCaptureEaseType ¶
func (self Instance) SetPlaybackAutoCaptureEaseType(value gdclass.TweenEaseType)
func (Instance) SetPlaybackAutoCaptureTransitionType ¶
func (self Instance) SetPlaybackAutoCaptureTransitionType(value gdclass.TweenTransitionType)
func (Instance) SetPlaybackDefaultBlendTime ¶
func (Instance) SetProcessCallback ¶
func (self Instance) SetProcessCallback(mode gdclass.AnimationPlayerAnimationProcessCallback)
Sets the process notification in which to update animations.
func (Instance) SetSection ¶
func (self Instance) SetSection()
Changes the start and end times of the section being played. The current playback position will be clamped within the new section. See also [method play_section].
func (Instance) SetSectionWithMarkers ¶
func (self Instance) SetSectionWithMarkers()
Changes the start and end markers of the section being played. The current playback position will be clamped within the new section. See also [method play_section_with_markers]. If the argument is empty, the section uses the beginning or end of the animation. If both are empty, it means that the section is not set.
func (Instance) SetSpeedScale ¶
func (Instance) SpeedScale ¶
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.