123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
- :github_url: hide
- .. DO NOT EDIT THIS FILE!!!
- .. Generated automatically from Godot engine sources.
- .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
- .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/AnimatedSprite3D.xml.
- .. _class_AnimatedSprite3D:
- AnimatedSprite3D
- ================
- **Inherits:** :ref:`SpriteBase3D<class_SpriteBase3D>` **<** :ref:`GeometryInstance3D<class_GeometryInstance3D>` **<** :ref:`VisualInstance3D<class_VisualInstance3D>` **<** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
- 2D sprite node in 3D world, that can use multiple 2D textures for animation.
- .. rst-class:: classref-introduction-group
- Description
- -----------
- **AnimatedSprite3D** is similar to the :ref:`Sprite3D<class_Sprite3D>` node, except it carries multiple textures as animation :ref:`sprite_frames<class_AnimatedSprite3D_property_sprite_frames>`. Animations are created using a :ref:`SpriteFrames<class_SpriteFrames>` resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The :ref:`SpriteFrames<class_SpriteFrames>` resource can be configured in the editor via the SpriteFrames bottom panel.
- .. rst-class:: classref-introduction-group
- Tutorials
- ---------
- - :doc:`2D Sprite animation (also applies to 3D) <../tutorials/2d/2d_sprite_animation>`
- .. rst-class:: classref-reftable-group
- Properties
- ----------
- .. table::
- :widths: auto
- +-----------------------------------------+-----------------------------------------------------------------------+----------------+
- | :ref:`StringName<class_StringName>` | :ref:`animation<class_AnimatedSprite3D_property_animation>` | ``&"default"`` |
- +-----------------------------------------+-----------------------------------------------------------------------+----------------+
- | :ref:`String<class_String>` | :ref:`autoplay<class_AnimatedSprite3D_property_autoplay>` | ``""`` |
- +-----------------------------------------+-----------------------------------------------------------------------+----------------+
- | :ref:`int<class_int>` | :ref:`frame<class_AnimatedSprite3D_property_frame>` | ``0`` |
- +-----------------------------------------+-----------------------------------------------------------------------+----------------+
- | :ref:`float<class_float>` | :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` | ``0.0`` |
- +-----------------------------------------+-----------------------------------------------------------------------+----------------+
- | :ref:`float<class_float>` | :ref:`speed_scale<class_AnimatedSprite3D_property_speed_scale>` | ``1.0`` |
- +-----------------------------------------+-----------------------------------------------------------------------+----------------+
- | :ref:`SpriteFrames<class_SpriteFrames>` | :ref:`sprite_frames<class_AnimatedSprite3D_property_sprite_frames>` | |
- +-----------------------------------------+-----------------------------------------------------------------------+----------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`float<class_float>` | :ref:`get_playing_speed<class_AnimatedSprite3D_method_get_playing_speed>`\ (\ ) |const| |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | :ref:`bool<class_bool>` | :ref:`is_playing<class_AnimatedSprite3D_method_is_playing>`\ (\ ) |const| |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`pause<class_AnimatedSprite3D_method_pause>`\ (\ ) |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`play<class_AnimatedSprite3D_method_play>`\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`play_backwards<class_AnimatedSprite3D_method_play_backwards>`\ (\ name\: :ref:`StringName<class_StringName>` = &""\ ) |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`set_frame_and_progress<class_AnimatedSprite3D_method_set_frame_and_progress>`\ (\ frame\: :ref:`int<class_int>`, progress\: :ref:`float<class_float>`\ ) |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- | |void| | :ref:`stop<class_AnimatedSprite3D_method_stop>`\ (\ ) |
- +---------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Signals
- -------
- .. _class_AnimatedSprite3D_signal_animation_changed:
- .. rst-class:: classref-signal
- **animation_changed**\ (\ ) :ref:`🔗<class_AnimatedSprite3D_signal_animation_changed>`
- Emitted when :ref:`animation<class_AnimatedSprite3D_property_animation>` changes.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_signal_animation_finished:
- .. rst-class:: classref-signal
- **animation_finished**\ (\ ) :ref:`🔗<class_AnimatedSprite3D_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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_signal_animation_looped:
- .. rst-class:: classref-signal
- **animation_looped**\ (\ ) :ref:`🔗<class_AnimatedSprite3D_signal_animation_looped>`
- Emitted when the animation loops.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_signal_frame_changed:
- .. rst-class:: classref-signal
- **frame_changed**\ (\ ) :ref:`🔗<class_AnimatedSprite3D_signal_frame_changed>`
- Emitted when :ref:`frame<class_AnimatedSprite3D_property_frame>` changes.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_signal_sprite_frames_changed:
- .. rst-class:: classref-signal
- **sprite_frames_changed**\ (\ ) :ref:`🔗<class_AnimatedSprite3D_signal_sprite_frames_changed>`
- Emitted when :ref:`sprite_frames<class_AnimatedSprite3D_property_sprite_frames>` changes.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Property Descriptions
- ---------------------
- .. _class_AnimatedSprite3D_property_animation:
- .. rst-class:: classref-property
- :ref:`StringName<class_StringName>` **animation** = ``&"default"`` :ref:`🔗<class_AnimatedSprite3D_property_animation>`
- .. rst-class:: classref-property-setget
- - |void| **set_animation**\ (\ value\: :ref:`StringName<class_StringName>`\ )
- - :ref:`StringName<class_StringName>` **get_animation**\ (\ )
- The current animation from the :ref:`sprite_frames<class_AnimatedSprite3D_property_sprite_frames>` resource. If this value is changed, the :ref:`frame<class_AnimatedSprite3D_property_frame>` counter and the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` are reset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_autoplay:
- .. rst-class:: classref-property
- :ref:`String<class_String>` **autoplay** = ``""`` :ref:`🔗<class_AnimatedSprite3D_property_autoplay>`
- .. rst-class:: classref-property-setget
- - |void| **set_autoplay**\ (\ value\: :ref:`String<class_String>`\ )
- - :ref:`String<class_String>` **get_autoplay**\ (\ )
- The key of the animation to play when the scene loads.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_frame:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **frame** = ``0`` :ref:`🔗<class_AnimatedSprite3D_property_frame>`
- .. rst-class:: classref-property-setget
- - |void| **set_frame**\ (\ value\: :ref:`int<class_int>`\ )
- - :ref:`int<class_int>` **get_frame**\ (\ )
- The displayed animation frame's index. Setting this property also resets :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>`. If this is not desired, use :ref:`set_frame_and_progress<class_AnimatedSprite3D_method_set_frame_and_progress>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_frame_progress:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **frame_progress** = ``0.0`` :ref:`🔗<class_AnimatedSprite3D_property_frame_progress>`
- .. rst-class:: classref-property-setget
- - |void| **set_frame_progress**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_frame_progress**\ (\ )
- 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``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_speed_scale:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **speed_scale** = ``1.0`` :ref:`🔗<class_AnimatedSprite3D_property_speed_scale>`
- .. rst-class:: classref-property-setget
- - |void| **set_speed_scale**\ (\ value\: :ref:`float<class_float>`\ )
- - :ref:`float<class_float>` **get_speed_scale**\ (\ )
- 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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_sprite_frames:
- .. rst-class:: classref-property
- :ref:`SpriteFrames<class_SpriteFrames>` **sprite_frames** :ref:`🔗<class_AnimatedSprite3D_property_sprite_frames>`
- .. rst-class:: classref-property-setget
- - |void| **set_sprite_frames**\ (\ value\: :ref:`SpriteFrames<class_SpriteFrames>`\ )
- - :ref:`SpriteFrames<class_SpriteFrames>` **get_sprite_frames**\ (\ )
- The :ref:`SpriteFrames<class_SpriteFrames>` resource containing the animation(s). Allows you the option to load, edit, clear, make unique and save the states of the :ref:`SpriteFrames<class_SpriteFrames>` resource.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_AnimatedSprite3D_method_get_playing_speed:
- .. rst-class:: classref-method
- :ref:`float<class_float>` **get_playing_speed**\ (\ ) |const| :ref:`🔗<class_AnimatedSprite3D_method_get_playing_speed>`
- Returns the actual playing speed of current animation or ``0`` if not playing. This speed is the :ref:`speed_scale<class_AnimatedSprite3D_property_speed_scale>` property multiplied by ``custom_speed`` argument specified when calling the :ref:`play<class_AnimatedSprite3D_method_play>` method.
- Returns a negative value if the current animation is playing backwards.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_method_is_playing:
- .. rst-class:: classref-method
- :ref:`bool<class_bool>` **is_playing**\ (\ ) |const| :ref:`🔗<class_AnimatedSprite3D_method_is_playing>`
- Returns ``true`` if an animation is currently playing (even if :ref:`speed_scale<class_AnimatedSprite3D_property_speed_scale>` and/or ``custom_speed`` are ``0``).
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_method_pause:
- .. rst-class:: classref-method
- |void| **pause**\ (\ ) :ref:`🔗<class_AnimatedSprite3D_method_pause>`
- Pauses the currently playing animation. The :ref:`frame<class_AnimatedSprite3D_property_frame>` and :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` will be kept and calling :ref:`play<class_AnimatedSprite3D_method_play>` or :ref:`play_backwards<class_AnimatedSprite3D_method_play_backwards>` without arguments will resume the animation from the current playback position.
- See also :ref:`stop<class_AnimatedSprite3D_method_stop>`.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_method_play:
- .. rst-class:: classref-method
- |void| **play**\ (\ name\: :ref:`StringName<class_StringName>` = &"", custom_speed\: :ref:`float<class_float>` = 1.0, from_end\: :ref:`bool<class_bool>` = false\ ) :ref:`🔗<class_AnimatedSprite3D_method_play>`
- 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 :ref:`play_backwards<class_AnimatedSprite3D_method_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.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_method_play_backwards:
- .. rst-class:: classref-method
- |void| **play_backwards**\ (\ name\: :ref:`StringName<class_StringName>` = &""\ ) :ref:`🔗<class_AnimatedSprite3D_method_play_backwards>`
- Plays the animation with key ``name`` in reverse.
- This method is a shorthand for :ref:`play<class_AnimatedSprite3D_method_play>` with ``custom_speed = -1.0`` and ``from_end = true``, so see its description for more information.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_method_set_frame_and_progress:
- .. rst-class:: classref-method
- |void| **set_frame_and_progress**\ (\ frame\: :ref:`int<class_int>`, progress\: :ref:`float<class_float>`\ ) :ref:`🔗<class_AnimatedSprite3D_method_set_frame_and_progress>`
- Sets :ref:`frame<class_AnimatedSprite3D_property_frame>` the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to the given values. Unlike setting :ref:`frame<class_AnimatedSprite3D_property_frame>`, this method does not reset the :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>` to ``0.0`` implicitly.
- \ **Example:** Change the animation while keeping the same :ref:`frame<class_AnimatedSprite3D_property_frame>` and :ref:`frame_progress<class_AnimatedSprite3D_property_frame_progress>`:
- .. tabs::
- .. code-tab:: gdscript
- 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)
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_method_stop:
- .. rst-class:: classref-method
- |void| **stop**\ (\ ) :ref:`🔗<class_AnimatedSprite3D_method_stop>`
- Stops the currently playing animation. The animation position is reset to ``0`` and the ``custom_speed`` is reset to ``1.0``. See also :ref:`pause<class_AnimatedSprite3D_method_pause>`.
- .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
- .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
- .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
- .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
- .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
- .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
- .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
- .. |void| replace:: :abbr:`void (No return value.)`
|