class_spriteframes.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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. Properties
  13. ----------
  14. +---------------------------+---------------------------------------------------+
  15. | :ref:`Array<class_Array>` | :ref:`frames<class_SpriteFrames_property_frames>` |
  16. +---------------------------+---------------------------------------------------+
  17. Methods
  18. -------
  19. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  20. | void | :ref:`add_animation<class_SpriteFrames_method_add_animation>` **(** :ref:`String<class_String>` anim **)** |
  21. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  22. | 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 **)** |
  23. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  24. | void | :ref:`clear<class_SpriteFrames_method_clear>` **(** :ref:`String<class_String>` anim **)** |
  25. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  26. | void | :ref:`clear_all<class_SpriteFrames_method_clear_all>` **(** **)** |
  27. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`get_animation_loop<class_SpriteFrames_method_get_animation_loop>` **(** :ref:`String<class_String>` anim **)** const |
  29. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  30. | :ref:`PoolStringArray<class_PoolStringArray>` | :ref:`get_animation_names<class_SpriteFrames_method_get_animation_names>` **(** **)** const |
  31. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`float<class_float>` | :ref:`get_animation_speed<class_SpriteFrames_method_get_animation_speed>` **(** :ref:`String<class_String>` anim **)** const |
  33. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`Texture<class_Texture>` | :ref:`get_frame<class_SpriteFrames_method_get_frame>` **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)** const |
  35. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_frame_count<class_SpriteFrames_method_get_frame_count>` **(** :ref:`String<class_String>` anim **)** const |
  37. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`bool<class_bool>` | :ref:`has_animation<class_SpriteFrames_method_has_animation>` **(** :ref:`String<class_String>` anim **)** const |
  39. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`remove_animation<class_SpriteFrames_method_remove_animation>` **(** :ref:`String<class_String>` anim **)** |
  41. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`remove_frame<class_SpriteFrames_method_remove_frame>` **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)** |
  43. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`rename_animation<class_SpriteFrames_method_rename_animation>` **(** :ref:`String<class_String>` anim, :ref:`String<class_String>` newname **)** |
  45. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | void | :ref:`set_animation_loop<class_SpriteFrames_method_set_animation_loop>` **(** :ref:`String<class_String>` anim, :ref:`bool<class_bool>` loop **)** |
  47. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | void | :ref:`set_animation_speed<class_SpriteFrames_method_set_animation_speed>` **(** :ref:`String<class_String>` anim, :ref:`float<class_float>` speed **)** |
  49. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`set_frame<class_SpriteFrames_method_set_frame>` **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` txt **)** |
  51. +-----------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. Description
  53. -----------
  54. Sprite frame library for :ref:`AnimatedSprite<class_AnimatedSprite>`. Contains frames and animation data for playback.
  55. Property Descriptions
  56. ---------------------
  57. .. _class_SpriteFrames_property_frames:
  58. - :ref:`Array<class_Array>` **frames**
  59. Method Descriptions
  60. -------------------
  61. .. _class_SpriteFrames_method_add_animation:
  62. - void **add_animation** **(** :ref:`String<class_String>` anim **)**
  63. Adds a new animation to the library.
  64. .. _class_SpriteFrames_method_add_frame:
  65. - void **add_frame** **(** :ref:`String<class_String>` anim, :ref:`Texture<class_Texture>` frame, :ref:`int<class_int>` at_position=-1 **)**
  66. Adds a frame to the given animation.
  67. .. _class_SpriteFrames_method_clear:
  68. - void **clear** **(** :ref:`String<class_String>` anim **)**
  69. Removes all frames from the given animation.
  70. .. _class_SpriteFrames_method_clear_all:
  71. - void **clear_all** **(** **)**
  72. Removes all animations. A "default" animation will be created.
  73. .. _class_SpriteFrames_method_get_animation_loop:
  74. - :ref:`bool<class_bool>` **get_animation_loop** **(** :ref:`String<class_String>` anim **)** const
  75. If ``true``, the given animation will loop.
  76. .. _class_SpriteFrames_method_get_animation_names:
  77. - :ref:`PoolStringArray<class_PoolStringArray>` **get_animation_names** **(** **)** const
  78. Returns an array containing the names associated to each animation. Values are placed in alphabetical order.
  79. .. _class_SpriteFrames_method_get_animation_speed:
  80. - :ref:`float<class_float>` **get_animation_speed** **(** :ref:`String<class_String>` anim **)** const
  81. The animation's speed in frames per second.
  82. .. _class_SpriteFrames_method_get_frame:
  83. - :ref:`Texture<class_Texture>` **get_frame** **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)** const
  84. Returns the animation's selected frame.
  85. .. _class_SpriteFrames_method_get_frame_count:
  86. - :ref:`int<class_int>` **get_frame_count** **(** :ref:`String<class_String>` anim **)** const
  87. Returns the number of frames in the animation.
  88. .. _class_SpriteFrames_method_has_animation:
  89. - :ref:`bool<class_bool>` **has_animation** **(** :ref:`String<class_String>` anim **)** const
  90. If ``true``, the named animation exists.
  91. .. _class_SpriteFrames_method_remove_animation:
  92. - void **remove_animation** **(** :ref:`String<class_String>` anim **)**
  93. Removes the given animation.
  94. .. _class_SpriteFrames_method_remove_frame:
  95. - void **remove_frame** **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx **)**
  96. Removes the animation's selected frame.
  97. .. _class_SpriteFrames_method_rename_animation:
  98. - void **rename_animation** **(** :ref:`String<class_String>` anim, :ref:`String<class_String>` newname **)**
  99. Changes the animation's name to ``newname``.
  100. .. _class_SpriteFrames_method_set_animation_loop:
  101. - void **set_animation_loop** **(** :ref:`String<class_String>` anim, :ref:`bool<class_bool>` loop **)**
  102. If ``true``, the animation will loop.
  103. .. _class_SpriteFrames_method_set_animation_speed:
  104. - void **set_animation_speed** **(** :ref:`String<class_String>` anim, :ref:`float<class_float>` speed **)**
  105. The animation's speed in frames per second.
  106. .. _class_SpriteFrames_method_set_frame:
  107. - void **set_frame** **(** :ref:`String<class_String>` anim, :ref:`int<class_int>` idx, :ref:`Texture<class_Texture>` txt **)**
  108. Sets the texture of the given frame.