123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- :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:`frames<class_AnimatedSprite3D_property_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.
- After setting up :ref:`frames<class_AnimatedSprite3D_property_frames>`, :ref:`play<class_AnimatedSprite3D_method_play>` may be called. It's also possible to select an :ref:`animation<class_AnimatedSprite3D_property_animation>` and toggle :ref:`playing<class_AnimatedSprite3D_property_playing>`, even within the editor.
- To pause the current animation, set :ref:`playing<class_AnimatedSprite3D_property_playing>` to ``false``. Alternatively, setting :ref:`speed_scale<class_AnimatedSprite3D_property_speed_scale>` to ``0`` also preserves the current frame's elapsed time.
- .. 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:`int<class_int>` | :ref:`frame<class_AnimatedSprite3D_property_frame>` | ``0`` |
- +-----------------------------------------+-----------------------------------------------------------------+----------------+
- | :ref:`SpriteFrames<class_SpriteFrames>` | :ref:`frames<class_AnimatedSprite3D_property_frames>` | |
- +-----------------------------------------+-----------------------------------------------------------------+----------------+
- | :ref:`bool<class_bool>` | :ref:`playing<class_AnimatedSprite3D_property_playing>` | ``false`` |
- +-----------------------------------------+-----------------------------------------------------------------+----------------+
- | :ref:`float<class_float>` | :ref:`speed_scale<class_AnimatedSprite3D_property_speed_scale>` | ``1.0`` |
- +-----------------------------------------+-----------------------------------------------------------------+----------------+
- .. rst-class:: classref-reftable-group
- Methods
- -------
- .. table::
- :widths: auto
- +------+---------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`play<class_AnimatedSprite3D_method_play>` **(** :ref:`StringName<class_StringName>` anim=&"", :ref:`bool<class_bool>` backwards=false **)** |
- +------+---------------------------------------------------------------------------------------------------------------------------------------------------+
- | void | :ref:`stop<class_AnimatedSprite3D_method_stop>` **(** **)** |
- +------+---------------------------------------------------------------------------------------------------------------------------------------------------+
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Signals
- -------
- .. _class_AnimatedSprite3D_signal_animation_finished:
- .. rst-class:: classref-signal
- **animation_finished** **(** **)**
- Emitted when the animation reaches the end, or the start if it is played in reverse. If the animation is looping, this signal is emitted at the end of each loop.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_signal_frame_changed:
- .. rst-class:: classref-signal
- **frame_changed** **(** **)**
- Emitted when :ref:`frame<class_AnimatedSprite3D_property_frame>` changed.
- .. 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"``
- .. rst-class:: classref-property-setget
- - void **set_animation** **(** :ref:`StringName<class_StringName>` value **)**
- - :ref:`StringName<class_StringName>` **get_animation** **(** **)**
- The current animation from the ``frames`` resource. If this value changes, the ``frame`` counter is reset.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_frame:
- .. rst-class:: classref-property
- :ref:`int<class_int>` **frame** = ``0``
- .. rst-class:: classref-property-setget
- - void **set_frame** **(** :ref:`int<class_int>` value **)**
- - :ref:`int<class_int>` **get_frame** **(** **)**
- The displayed animation frame's index.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_frames:
- .. rst-class:: classref-property
- :ref:`SpriteFrames<class_SpriteFrames>` **frames**
- .. rst-class:: classref-property-setget
- - void **set_sprite_frames** **(** :ref:`SpriteFrames<class_SpriteFrames>` value **)**
- - :ref:`SpriteFrames<class_SpriteFrames>` **get_sprite_frames** **(** **)**
- The :ref:`SpriteFrames<class_SpriteFrames>` resource containing the animation(s).
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_playing:
- .. rst-class:: classref-property
- :ref:`bool<class_bool>` **playing** = ``false``
- .. rst-class:: classref-property-setget
- - void **set_playing** **(** :ref:`bool<class_bool>` value **)**
- - :ref:`bool<class_bool>` **is_playing** **(** **)**
- If ``true``, the :ref:`animation<class_AnimatedSprite3D_property_animation>` is currently playing. Setting this property to ``false`` pauses the current animation. Use :ref:`stop<class_AnimatedSprite3D_method_stop>` to stop the animation at the current frame instead.
- \ **Note:** Unlike :ref:`stop<class_AnimatedSprite3D_method_stop>`, changing this property to ``false`` preserves the current frame's elapsed time and the ``backwards`` flag of the current :ref:`animation<class_AnimatedSprite3D_property_animation>` (if it was previously set by :ref:`play<class_AnimatedSprite3D_method_play>`).
- \ **Note:** After a non-looping animation finishes, the property still remains ``true``.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_property_speed_scale:
- .. rst-class:: classref-property
- :ref:`float<class_float>` **speed_scale** = ``1.0``
- .. rst-class:: classref-property-setget
- - void **set_speed_scale** **(** :ref:`float<class_float>` value **)**
- - :ref:`float<class_float>` **get_speed_scale** **(** **)**
- The animation speed is multiplied by this value. If set to a negative value, the animation is played in reverse. If set to ``0``, the animation is paused, preserving the current frame's elapsed time.
- .. rst-class:: classref-section-separator
- ----
- .. rst-class:: classref-descriptions-group
- Method Descriptions
- -------------------
- .. _class_AnimatedSprite3D_method_play:
- .. rst-class:: classref-method
- void **play** **(** :ref:`StringName<class_StringName>` anim=&"", :ref:`bool<class_bool>` backwards=false **)**
- Plays the animation named ``anim``. If no ``anim`` is provided, the current animation is played. If ``backwards`` is ``true``, the animation is played in reverse.
- \ **Note:** If :ref:`speed_scale<class_AnimatedSprite3D_property_speed_scale>` is negative, the animation direction specified by ``backwards`` will be inverted.
- .. rst-class:: classref-item-separator
- ----
- .. _class_AnimatedSprite3D_method_stop:
- .. rst-class:: classref-method
- void **stop** **(** **)**
- Stops the current :ref:`animation<class_AnimatedSprite3D_property_animation>` at the current :ref:`frame<class_AnimatedSprite3D_property_frame>`.
- \ **Note:** This method resets the current frame's elapsed time and removes the ``backwards`` flag from the current :ref:`animation<class_AnimatedSprite3D_property_animation>` (if it was previously set by :ref:`play<class_AnimatedSprite3D_method_play>`). If this behavior is undesired, set :ref:`playing<class_AnimatedSprite3D_property_playing>` to ``false`` instead.
- .. |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.)`
|