Inheritance #
- AudioServer
- CameraServer
- ClassDB
- DisplayServer
- EditorFileSystemDirectory
- EditorInterface
- EditorPaths
- EditorSelection
- EditorUndoRedoManager
- EditorVCSInterface
- Engine
- EngineDebugger
- FramebufferCacheRD
- GDExtensionManager
- Geometry2D
- Geometry3D
- IP
- Input
- InputMap
- JNISingleton
- JSONRPC
- JavaClassWrapper
- JavaScriptBridge
- MainLoop (1)
- Marshalls
- MovieWriter
- NativeMenu
- NavigationMeshGenerator
- NavigationServer2D
- NavigationServer3D
- Node (21)
- OS
- OpenXRExtensionWrapperExtension
- OpenXRInteractionProfileMetadata
- Performance
- PhysicsDirectBodyState2D (1)
- PhysicsDirectBodyState3D (1)
- PhysicsDirectSpaceState2D (1)
- PhysicsDirectSpaceState3D (1)
- PhysicsServer2D (1)
- PhysicsServer2DManager
- PhysicsServer3D (1)
- PhysicsServer3DManager
- PhysicsServer3DRendering
ServerHandler
- ProjectSettings
- RefCounted (121)
- RenderData (2)
- RenderSceneData (2)
- RenderingDevice
- RenderingServer
- ResourceLoader
- ResourceSaver
- ResourceUID
- ScriptLanguage (1)
- ShaderIncludeDB
- TextServerManager
- ThemeDB
- TileData
- Time
- TranslationServer
- TreeItem
- UndoRedo
- UniformSetCacheRD
- WorkerThreadPool
- XRServer
- XRVRS
- AnimationMixer (2)
- AudioStreamPlayer
- CanvasItem (2)
- CanvasLayer (1)
- EditorFileSystem
- EditorPlugin (1)
- EditorResourcePreview
- HTTPRequest
- InstancePlaceholder
- MissingNode
- MultiplayerSpawner
- MultiplayerSynchronizer
- NavigationAgent2D
- NavigationAgent3D
- Node3D (31)
- ResourcePreloader
- ShaderGlobalsOverride
- StatusIndicator
- Timer
- Viewport (2)
- WorldEnvironment
- AudioListener3D
- AudioStreamPlayer3D
- BoneAttachment3D
- Camera3D (1)
- CollisionObject3D (2)
- CollisionPolygon3D
- CollisionShape3D
- GridMap
- ImporterMeshInstance3D
- Joint3D (5)
- LightmapProbe
- Marker3D
- NavigationLink3D
- NavigationObstacle3D
- NavigationRegion3D
- OpenXRCompositionLayer (3)
- OpenXRHand
- Path3D
- PathFollow3D
- RayCast3D
- RemoteTransform3D
- ShapeCast3D
- Skeleton3D
- SkeletonModifier3D (7)
- SpringArm3D
- SpringBoneCollision3D (3)
- VehicleWheel3D
- VisualInstance3D (13)
- XRFaceModifier3D
- XRNode3D (2)
- XROrigin3D
- Decal
- FogVolume
- GPUParticlesAttractor3D (3)
- GPUParticlesCollision3D (4)
- GeometryInstance3D (7)
- Light3D (3)
- LightmapGI
- OccluderInstance3D
- OpenXRVisibilityMask
- ReflectionProbe
- RootMotionView
- VisibleOnScreenNotifier3D (1)
- VoxelGI
- CPUParticles3D
- CSGShape3D (2)
- GPUParticles3D
- Label3D
- MeshInstance3D (1)
- MultiMeshInstance3D
- SpriteBase3D (2)
Table of contents
-
var animation: StringName = &"default" -
var autoplay: String = "" -
var frame: int = 0 -
var frame_progress: float = 0.0 -
var speed_scale: float = 1.0 -
var sprite_frames: SpriteFrames -
const func get_playing_speed() -> float -
const func is_playing() -> bool -
func pause() -> void -
func play(from_end: bool = false) -> void -
func play_backwards(name: StringName = &"") -> void -
func set_frame_and_progress(progress: float) -> void -
func stop() -> void -
signal animation_changed() -
signal animation_finished() -
signal animation_looped() -
signal frame_changed() -
signal sprite_frames_changed()
AnimatedSprite3D #
is_instantiable, Node3D, Node, core, not_builtin_classes
2D sprite node in 3D world, that can use multiple 2D textures for animation.
AnimatedSprite3D is similar to the Sprite3D node, except it carries multiple textures as animation sprite_frames. Animations are created using a SpriteFrames resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The SpriteFrames resource can be configured in the editor via the SpriteFrames bottom panel.
Members #
var animation: StringName = &"default"#
The current animation from the sprite_frames resource. If this value is changed, the frame counter and the frame_progress are reset.
var autoplay: String = ""#
The key of the animation to play when the scene loads.
var frame: int = 0#
The displayed animation frame's index. Setting this property also resets frame_progress. If this is not desired, use set_frame_and_progress.
var frame_progress: float = 0.0#
The progress value between 0.0 and 1.0 until the current frame transitions to the next frame. If the animation is playing backwards, the value transitions from 1.0 to 0.0.
var speed_scale: float = 1.0#
The speed scaling ratio. For example, if this value is 1, then the animation plays at normal speed. If it's 0.5, then it plays at half speed. If it's 2, then it plays at double speed.
If set to a negative value, the animation is played in reverse. If set to 0, the animation will not advance.
var sprite_frames: SpriteFrames#
The SpriteFrames resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the SpriteFrames resource.
Methods #
const func get_playing_speed() -> float#
Returns the actual playing speed of current animation or 0 if not playing. This speed is the speed_scale property multiplied by custom_speed argument specified when calling the play method.
Returns a negative value if the current animation is playing backwards.
const func is_playing() -> bool#
Returns true if an animation is currently playing (even if speed_scale and/or custom_speed are 0).
func pause() -> void#
Pauses the currently playing animation. The frame and frame_progress will be kept and calling play or play_backwards without arguments will resume the animation from the current playback position.
See also stop.
func play(from_end: bool = false) -> void#
Plays the animation with key name. If custom_speed is negative and from_end is true, the animation will play backwards (which is equivalent to calling play_backwards).
If this method is called with that same animation name, or with no name parameter, the assigned animation will resume playing if it was paused.
func play_backwards(name: StringName = &"") -> void#
Plays the animation with key name in reverse.
This method is a shorthand for play with custom_speed = -1.0 and from_end = true, so see its description for more information.
func set_frame_and_progress(progress: float) -> void#
Sets frame the frame_progress to the given values. Unlike setting frame, this method does not reset the frame_progress to 0.0 implicitly.
Example: Change the animation while keeping the same frame and frame_progress:
var current_frame = animated_sprite.get_frame()
var current_progress = animated_sprite.get_frame_progress()
animated_sprite.play("walk_another_skin")
animated_sprite.set_frame_and_progress(current_frame, current_progress)func stop() -> void#
Stops the currently playing animation. The animation position is reset to 0 and the custom_speed is reset to 1.0. See also pause.
Annotations #
Constants #
Constructors #
Enums #
Operators #
Signals #
signal animation_changed()#
Emitted when animation changes.
signal animation_finished()#
Emitted when the animation reaches the end, or the start if it is played in reverse. When the animation finishes, it pauses the playback.
Note: This signal is not emitted if an animation is looping.
signal animation_looped()#
Emitted when the animation loops.
signal frame_changed()#
Emitted when frame changes.
signal sprite_frames_changed()#
Emitted when sprite_frames changes.