:github_url: hide .. Generated automatically by doc/tools/make_rst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the AnimatedTexture.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_AnimatedTexture: AnimatedTexture =============== **Inherits:** :ref:`Texture` **<** :ref:`Resource` **<** :ref:`Reference` **<** :ref:`Object` Textura de conexión para animaciones simples basadas en fotogramas. Descripción ---------------------- ``AnimatedTexture`` is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike :ref:`AnimationPlayer` or :ref:`AnimatedSprite`, it isn't a :ref:`Node`, but has the advantage of being usable anywhere a :ref:`Texture` resource can be used, e.g. in a :ref:`TileSet`. The playback of the animation is controlled by the :ref:`fps` property as well as each frame's optional delay (see :ref:`set_frame_delay`). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame. \ ``AnimatedTexture`` currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one. \ **Note:** AnimatedTexture doesn't support using :ref:`AtlasTexture`\ s. Each frame needs to be a separate :ref:`Texture`. Propiedades ---------------------- +---------------------------+--------------------------------------------------------------------+----------------------------------------------------------------+ | :ref:`int` | :ref:`current_frame` | | +---------------------------+--------------------------------------------------------------------+----------------------------------------------------------------+ | :ref:`int` | flags | ``0`` (overrides :ref:`Texture`) | +---------------------------+--------------------------------------------------------------------+----------------------------------------------------------------+ | :ref:`float` | :ref:`fps` | ``4.0`` | +---------------------------+--------------------------------------------------------------------+----------------------------------------------------------------+ | :ref:`int` | :ref:`frames` | ``1`` | +---------------------------+--------------------------------------------------------------------+----------------------------------------------------------------+ | :ref:`bool` | :ref:`oneshot` | ``false`` | +---------------------------+--------------------------------------------------------------------+----------------------------------------------------------------+ | :ref:`bool` | :ref:`pause` | ``false`` | +---------------------------+--------------------------------------------------------------------+----------------------------------------------------------------+ Métodos -------------- +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`float` | :ref:`get_frame_delay` **(** :ref:`int` frame **)** |const| | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Texture` | :ref:`get_frame_texture` **(** :ref:`int` frame **)** |const| | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_frame_delay` **(** :ref:`int` frame, :ref:`float` delay **)** | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_frame_texture` **(** :ref:`int` frame, :ref:`Texture` texture **)** | +-------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------+ Constantes -------------------- .. _class_AnimatedTexture_constant_MAX_FRAMES: - **MAX_FRAMES** = **256** --- The maximum number of frames supported by ``AnimatedTexture``. If you need more frames in your animation, use :ref:`AnimationPlayer` or :ref:`AnimatedSprite`. Descripciones de Propiedades -------------------------------------------------------- .. _class_AnimatedTexture_property_current_frame: - :ref:`int` **current_frame** +----------+--------------------------+ | *Setter* | set_current_frame(value) | +----------+--------------------------+ | *Getter* | get_current_frame() | +----------+--------------------------+ Establece el fotograma actualmente visible de la textura. ---- .. _class_AnimatedTexture_property_fps: - :ref:`float` **fps** +-----------+----------------+ | *Default* | ``4.0`` | +-----------+----------------+ | *Setter* | set_fps(value) | +-----------+----------------+ | *Getter* | get_fps() | +-----------+----------------+ Velocidad de animación en fotogramas por segundo. Este valor define el intervalo de tiempo por defecto entre dos fotogramas de la animación, y por lo tanto la duración total del bucle de animación basado en la propiedad :ref:`frames`. Un valor de 0 significa que no hay un número predefinido de fotogramas por segundo, la animación se reproducirá de acuerdo con el retardo de fotogramas de cada fotograma (ver :ref:`set_frame_delay`). Por ejemplo, una animación con 8 fotogramas, sin retardo de fotograma y un valor ``fps`` de 2 se ejecutará durante 4 segundos, y cada fotograma durará 0,5 segundos. ---- .. _class_AnimatedTexture_property_frames: - :ref:`int` **frames** +-----------+-------------------+ | *Default* | ``1`` | +-----------+-------------------+ | *Setter* | set_frames(value) | +-----------+-------------------+ | *Getter* | get_frames() | +-----------+-------------------+ Número de fotogramas a usar en la animación. Aunque puedes crear los fotogramas independientemente con :ref:`set_frame_texture`, necesitas establecer este valor para que la animación tenga en cuenta los nuevos fotogramas. El número máximo de fotogramas es :ref:`MAX_FRAMES`. ---- .. _class_AnimatedTexture_property_oneshot: - :ref:`bool` **oneshot** +-----------+--------------------+ | *Default* | ``false`` | +-----------+--------------------+ | *Setter* | set_oneshot(value) | +-----------+--------------------+ | *Getter* | get_oneshot() | +-----------+--------------------+ Si ``true``, la animación sólo se reproducirá una vez y no volverá al primer fotograma después de llegar al final. Ten en cuenta que al llegar al final no se establecerá :ref:`pause` en ``true``. ---- .. _class_AnimatedTexture_property_pause: - :ref:`bool` **pause** +-----------+------------------+ | *Default* | ``false`` | +-----------+------------------+ | *Setter* | set_pause(value) | +-----------+------------------+ | *Getter* | get_pause() | +-----------+------------------+ Si ``true``, la animación se detendrá donde se encuentra actualmente (es decir, en :ref:`current_frame`). La animación continuará desde donde se detuvo al cambiar esta propiedad a ``false``. Descripciones de Métodos ------------------------------------------------ .. _class_AnimatedTexture_method_get_frame_delay: - :ref:`float` **get_frame_delay** **(** :ref:`int` frame **)** |const| Devuelve el valor de retardo del fotograma dado. ---- .. _class_AnimatedTexture_method_get_frame_texture: - :ref:`Texture` **get_frame_texture** **(** :ref:`int` frame **)** |const| Returns the given frame's :ref:`Texture`. ---- .. _class_AnimatedTexture_method_set_frame_delay: - void **set_frame_delay** **(** :ref:`int` frame, :ref:`float` delay **)** Establece un retardo adicional (en segundos) entre este fotograma y el siguiente, que se añadirá al intervalo de tiempo definido por :ref:`fps`. Por defecto, los fotogramas no tienen definido ningún retardo. Si se define un valor de retardo, el intervalo de tiempo final entre este fotograma y el siguiente será de ``1.0 / fps + retardo``. Por ejemplo, para una animación con 3 cuadros, 2 FPS y un retardo de fotograma en el segundo cuadro de 1.2, la reproducción resultante será: :: Fotograma 0: 0.5 s (1 / fps) Fotograma 1: 1.7 s (1 / fps + 1.2) Fotograma 2: 0.5 s (1 / fps) Duración Total : 2.7 segundos ---- .. _class_AnimatedTexture_method_set_frame_texture: - void **set_frame_texture** **(** :ref:`int` frame, :ref:`Texture` texture **)** Assigns a :ref:`Texture` to the given frame. Frame IDs start at 0, so the first frame has ID 0, and the last frame of the animation has ID :ref:`frames` - 1. You can define any number of textures up to :ref:`MAX_FRAMES`, but keep in mind that only frames from 0 to :ref:`frames` - 1 will be part of the animation. .. |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.)`