class_spriteframes.rst 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the SpriteFrames.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_SpriteFrames:
  5. SpriteFrames
  6. ============
  7. **Inherits:** :ref:`Resource<class_resource>` **<** :ref:`Reference<class_reference>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Sprite frame library for AnimatedSprite.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`add_animation<class_SpriteFrames_add_animation>` **(** :ref:`String<class_string>` anim **)** |
  16. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`add_frame<class_SpriteFrames_add_frame>` **(** :ref:`String<class_string>` anim, :ref:`Texture<class_texture>` frame, :ref:`int<class_int>` at_position=-1 **)** |
  18. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`clear<class_SpriteFrames_clear>` **(** :ref:`String<class_string>` anim **)** |
  20. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`clear_all<class_SpriteFrames_clear_all>` **(** **)** |
  22. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`bool<class_bool>` | :ref:`get_animation_loop<class_SpriteFrames_get_animation_loop>` **(** :ref:`String<class_string>` anim **)** const |
  24. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`float<class_float>` | :ref:`get_animation_speed<class_SpriteFrames_get_animation_speed>` **(** :ref:`String<class_string>` anim **)** const |
  26. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Texture<class_texture>` | :ref:`get_frame<class_SpriteFrames_get_frame>` **(** :ref:`String<class_string>` anim, :ref:`int<class_int>` idx **)** const |
  28. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_frame_count<class_SpriteFrames_get_frame_count>` **(** :ref:`String<class_string>` anim **)** const |
  30. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`bool<class_bool>` | :ref:`has_animation<class_SpriteFrames_has_animation>` **(** :ref:`String<class_string>` anim **)** const |
  32. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`remove_animation<class_SpriteFrames_remove_animation>` **(** :ref:`String<class_string>` anim **)** |
  34. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`remove_frame<class_SpriteFrames_remove_frame>` **(** :ref:`String<class_string>` anim, :ref:`int<class_int>` idx **)** |
  36. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`rename_animation<class_SpriteFrames_rename_animation>` **(** :ref:`String<class_string>` anim, :ref:`String<class_string>` newname **)** |
  38. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`set_animation_loop<class_SpriteFrames_set_animation_loop>` **(** :ref:`String<class_string>` anim, :ref:`bool<class_bool>` loop **)** |
  40. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_animation_speed<class_SpriteFrames_set_animation_speed>` **(** :ref:`String<class_string>` anim, :ref:`float<class_float>` speed **)** |
  42. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_frame<class_SpriteFrames_set_frame>` **(** :ref:`String<class_string>` anim, :ref:`int<class_int>` idx, :ref:`Texture<class_texture>` txt **)** |
  44. +--------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. Member Variables
  46. ----------------
  47. .. _class_SpriteFrames_frames:
  48. - :ref:`Array<class_array>` **frames**
  49. Description
  50. -----------
  51. Sprite frame library for :ref:`AnimatedSprite<class_animatedsprite>`. Contains frames and animation data for playback.
  52. Member Function Description
  53. ---------------------------
  54. .. _class_SpriteFrames_add_animation:
  55. - void **add_animation** **(** :ref:`String<class_string>` anim **)**
  56. Adds a new animation to the the library.
  57. .. _class_SpriteFrames_add_frame:
  58. - void **add_frame** **(** :ref:`String<class_string>` anim, :ref:`Texture<class_texture>` frame, :ref:`int<class_int>` at_position=-1 **)**
  59. Adds a frame to the given animation.
  60. .. _class_SpriteFrames_clear:
  61. - void **clear** **(** :ref:`String<class_string>` anim **)**
  62. Removes all frames from the given animation.
  63. .. _class_SpriteFrames_clear_all:
  64. - void **clear_all** **(** **)**
  65. Removes all animations. A "default" animation will be created.
  66. .. _class_SpriteFrames_get_animation_loop:
  67. - :ref:`bool<class_bool>` **get_animation_loop** **(** :ref:`String<class_string>` anim **)** const
  68. If ``true`` the given animation will loop.
  69. .. _class_SpriteFrames_get_animation_speed:
  70. - :ref:`float<class_float>` **get_animation_speed** **(** :ref:`String<class_string>` anim **)** const
  71. The animation's speed in frames per second.
  72. .. _class_SpriteFrames_get_frame:
  73. - :ref:`Texture<class_texture>` **get_frame** **(** :ref:`String<class_string>` anim, :ref:`int<class_int>` idx **)** const
  74. Returns the animation's selected frame.
  75. .. _class_SpriteFrames_get_frame_count:
  76. - :ref:`int<class_int>` **get_frame_count** **(** :ref:`String<class_string>` anim **)** const
  77. Returns the number of frames in the animation.
  78. .. _class_SpriteFrames_has_animation:
  79. - :ref:`bool<class_bool>` **has_animation** **(** :ref:`String<class_string>` anim **)** const
  80. If ``true`` the named animation exists.
  81. .. _class_SpriteFrames_remove_animation:
  82. - void **remove_animation** **(** :ref:`String<class_string>` anim **)**
  83. Removes the given animation.
  84. .. _class_SpriteFrames_remove_frame:
  85. - void **remove_frame** **(** :ref:`String<class_string>` anim, :ref:`int<class_int>` idx **)**
  86. Removes the animation's selected frame.
  87. .. _class_SpriteFrames_rename_animation:
  88. - void **rename_animation** **(** :ref:`String<class_string>` anim, :ref:`String<class_string>` newname **)**
  89. Changes the animation's name to ``newname``.
  90. .. _class_SpriteFrames_set_animation_loop:
  91. - void **set_animation_loop** **(** :ref:`String<class_string>` anim, :ref:`bool<class_bool>` loop **)**
  92. If ``true`` the animation will loop.
  93. .. _class_SpriteFrames_set_animation_speed:
  94. - void **set_animation_speed** **(** :ref:`String<class_string>` anim, :ref:`float<class_float>` speed **)**
  95. The animation's speed in frames per second.
  96. .. _class_SpriteFrames_set_frame:
  97. - void **set_frame** **(** :ref:`String<class_string>` anim, :ref:`int<class_int>` idx, :ref:`Texture<class_texture>` txt **)**
  98. Sets the texture of the given frame.