class_spriteframes.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  1. :github_url: hide
  2. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  3. .. DO NOT EDIT THIS FILE, but the SpriteFrames.xml source instead.
  4. .. The source is found in doc/classes or modules/<name>/doc_classes.
  5. .. _class_SpriteFrames:
  6. SpriteFrames
  7. ============
  8. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`Reference<class_Reference>` **<** :ref:`Object<class_Object>`
  9. **Category:** Core
  10. Brief Description
  11. -----------------
  12. Sprite frame library for AnimatedSprite.
  13. Properties
  14. ----------
  15. +---------------------------+---------------------------------------------------+
  16. | :ref:`Array<class_Array>` | :ref:`frames<class_SpriteFrames_property_frames>` |
  17. +---------------------------+---------------------------------------------------+
  18. Methods
  19. -------
  20. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | void | :ref:`add_animation<class_SpriteFrames_method_add_animation>` **(** :ref:`String<class_String>` anim **)** |
  22. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`add_frame<class_SpriteFrames_method_add_frame>` **(** :ref:`String<class_String>` anim, :ref:`Texture<class_Texture>` frame, :ref:`int<class_int>` at_position=-1 **)** |
  24. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | void | :ref:`clear<class_SpriteFrames_method_clear>` **(** :ref:`String<class_String>` anim **)** |
  26. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`clear_all<class_SpriteFrames_method_clear_all>` **(** **)** |
  28. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`get_animation_loop<class_SpriteFrames_method_get_animation_loop>` **(** :ref:`String<class_String>` anim **)** const |
  30. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_animation_names<class_SpriteFrames_method_get_animation_names>` **(** **)** const |
  32. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`float<class_float>` | :ref:`get_animation_speed<class_SpriteFrames_method_get_animation_speed>` **(** :ref:`String<class_String>` anim **)** const |
  34. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | :ref:`Texture<class_Texture>` | :ref:`get_frame<class_SpriteFrames_method_get_frame>` **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)** const |
  36. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`int<class_int>` | :ref:`get_frame_count<class_SpriteFrames_method_get_frame_count>` **(** :ref:`String<class_String>` anim **)** const |
  38. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`has_animation<class_SpriteFrames_method_has_animation>` **(** :ref:`String<class_String>` anim **)** const |
  40. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`remove_animation<class_SpriteFrames_method_remove_animation>` **(** :ref:`String<class_String>` anim **)** |
  42. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`remove_frame<class_SpriteFrames_method_remove_frame>` **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)** |
  44. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`rename_animation<class_SpriteFrames_method_rename_animation>` **(** :ref:`String<class_String>` anim, :ref:`String<class_String>` newname **)** |
  46. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`set_animation_loop<class_SpriteFrames_method_set_animation_loop>` **(** :ref:`String<class_String>` anim, :ref:`bool<class_bool>` loop **)** |
  48. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`set_animation_speed<class_SpriteFrames_method_set_animation_speed>` **(** :ref:`String<class_String>` anim, :ref:`float<class_float>` speed **)** |
  50. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`set_frame<class_SpriteFrames_method_set_frame>` **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` txt **)** |
  52. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. Description
  54. -----------
  55. Sprite frame library for :ref:`AnimatedSprite<class_AnimatedSprite>`. Contains frames and animation data for playback.
  56. Property Descriptions
  57. ---------------------
  58. .. _class_SpriteFrames_property_frames:
  59. - :ref:`Array<class_Array>` **frames**
  60. Method Descriptions
  61. -------------------
  62. .. _class_SpriteFrames_method_add_animation:
  63. - void **add_animation** **(** :ref:`String<class_String>` anim **)**
  64. Adds a new animation to the library.
  65. ----
  66. .. _class_SpriteFrames_method_add_frame:
  67. - void **add_frame** **(** :ref:`String<class_String>` anim, :ref:`Texture<class_Texture>` frame, :ref:`int<class_int>` at_position=-1 **)**
  68. Adds a frame to the given animation.
  69. ----
  70. .. _class_SpriteFrames_method_clear:
  71. - void **clear** **(** :ref:`String<class_String>` anim **)**
  72. Removes all frames from the given animation.
  73. ----
  74. .. _class_SpriteFrames_method_clear_all:
  75. - void **clear_all** **(** **)**
  76. Removes all animations. A "default" animation will be created.
  77. ----
  78. .. _class_SpriteFrames_method_get_animation_loop:
  79. - :ref:`bool<class_bool>` **get_animation_loop** **(** :ref:`String<class_String>` anim **)** const
  80. If ``true``, the given animation will loop.
  81. ----
  82. .. _class_SpriteFrames_method_get_animation_names:
  83. - :ref:`PoolStringArray<class_PoolStringArray>` **get_animation_names** **(** **)** const
  84. Returns an array containing the names associated to each animation. Values are placed in alphabetical order.
  85. ----
  86. .. _class_SpriteFrames_method_get_animation_speed:
  87. - :ref:`float<class_float>` **get_animation_speed** **(** :ref:`String<class_String>` anim **)** const
  88. The animation's speed in frames per second.
  89. ----
  90. .. _class_SpriteFrames_method_get_frame:
  91. - :ref:`Texture<class_Texture>` **get_frame** **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)** const
  92. Returns the animation's selected frame.
  93. ----
  94. .. _class_SpriteFrames_method_get_frame_count:
  95. - :ref:`int<class_int>` **get_frame_count** **(** :ref:`String<class_String>` anim **)** const
  96. Returns the number of frames in the animation.
  97. ----
  98. .. _class_SpriteFrames_method_has_animation:
  99. - :ref:`bool<class_bool>` **has_animation** **(** :ref:`String<class_String>` anim **)** const
  100. If ``true``, the named animation exists.
  101. ----
  102. .. _class_SpriteFrames_method_remove_animation:
  103. - void **remove_animation** **(** :ref:`String<class_String>` anim **)**
  104. Removes the given animation.
  105. ----
  106. .. _class_SpriteFrames_method_remove_frame:
  107. - void **remove_frame** **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)**
  108. Removes the animation's selected frame.
  109. ----
  110. .. _class_SpriteFrames_method_rename_animation:
  111. - void **rename_animation** **(** :ref:`String<class_String>` anim, :ref:`String<class_String>` newname **)**
  112. Changes the animation's name to ``newname``.
  113. ----
  114. .. _class_SpriteFrames_method_set_animation_loop:
  115. - void **set_animation_loop** **(** :ref:`String<class_String>` anim, :ref:`bool<class_bool>` loop **)**
  116. If ``true``, the animation will loop.
  117. ----
  118. .. _class_SpriteFrames_method_set_animation_speed:
  119. - void **set_animation_speed** **(** :ref:`String<class_String>` anim, :ref:`float<class_float>` speed **)**
  120. The animation's speed in frames per second.
  121. ----
  122. .. _class_SpriteFrames_method_set_frame:
  123. - void **set_frame** **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` txt **)**
  124. Sets the texture of the given frame.