Improve `SpriteFrames` docs
This commit is contained in:
parent
d3fc9d9e41
commit
35bdd8eae4
|
@ -7,7 +7,6 @@
|
||||||
[AnimatedSprite2D] is similar to the [Sprite2D] node, except it carries multiple textures as animation frames. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel.
|
[AnimatedSprite2D] is similar to the [Sprite2D] node, except it carries multiple textures as animation frames. Animations are created using a [SpriteFrames] resource, which allows you to import image files (or a folder containing said files) to provide the animation frames for the sprite. The [SpriteFrames] resource can be configured in the editor via the SpriteFrames bottom panel.
|
||||||
After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor.
|
After setting up [member frames], [method play] may be called. It's also possible to select an [member animation] and toggle [member playing], even within the editor.
|
||||||
To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time.
|
To pause the current animation, set [member playing] to [code]false[/code]. Alternatively, setting [member speed_scale] to [code]0[/code] also preserves the current frame's elapsed time.
|
||||||
[b]Note:[/b] You can associate a set of normal or specular maps by creating additional [SpriteFrames] resources with a [code]_normal[/code] or [code]_specular[/code] suffix. For example, having 3 [SpriteFrames] resources [code]run[/code], [code]run_normal[/code], and [code]run_specular[/code] will make it so the [code]run[/code] animation uses normal and specular maps.
|
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
<link title="2D Sprite animation">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link>
|
<link title="2D Sprite animation">$DOCS_URL/tutorials/2d/2d_sprite_animation.html</link>
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
</brief_description>
|
</brief_description>
|
||||||
<description>
|
<description>
|
||||||
Sprite frame library for an [AnimatedSprite2D] or [AnimatedSprite3D] node. Contains frames and animation data for playback.
|
Sprite frame library for an [AnimatedSprite2D] or [AnimatedSprite3D] node. Contains frames and animation data for playback.
|
||||||
[b]Note:[/b] You can associate a set of normal or specular maps by creating additional [SpriteFrames] resources with a [code]_normal[/code] or [code]_specular[/code] suffix. For example, having 3 [SpriteFrames] resources [code]run[/code], [code]run_normal[/code], and [code]run_specular[/code] will make it so the [code]run[/code] animation uses normal and specular maps.
|
|
||||||
</description>
|
</description>
|
||||||
<tutorials>
|
<tutorials>
|
||||||
</tutorials>
|
</tutorials>
|
||||||
|
@ -14,7 +13,7 @@
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="anim" type="StringName" />
|
<param index="0" name="anim" type="StringName" />
|
||||||
<description>
|
<description>
|
||||||
Adds a new animation to the library.
|
Adds a new [param anim] animation to the library.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="add_frame">
|
<method name="add_frame">
|
||||||
|
@ -24,20 +23,20 @@
|
||||||
<param index="2" name="duration" type="float" default="1.0" />
|
<param index="2" name="duration" type="float" default="1.0" />
|
||||||
<param index="3" name="at_position" type="int" default="-1" />
|
<param index="3" name="at_position" type="int" default="-1" />
|
||||||
<description>
|
<description>
|
||||||
Adds a frame to the given animation.
|
Adds a frame to the [param anim] animation. If [param at_position] is [code]-1[/code], the frame will be added to the end of the animation.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="clear">
|
<method name="clear">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="anim" type="StringName" />
|
<param index="0" name="anim" type="StringName" />
|
||||||
<description>
|
<description>
|
||||||
Removes all frames from the given animation.
|
Removes all frames from the [param anim] animation.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="clear_all">
|
<method name="clear_all">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<description>
|
<description>
|
||||||
Removes all animations. A "default" animation will be created.
|
Removes all animations. An empty [code]default[/code] animation will be created.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="get_animation_loop" qualifiers="const">
|
<method name="get_animation_loop" qualifiers="const">
|
||||||
|
@ -91,14 +90,14 @@
|
||||||
<return type="bool" />
|
<return type="bool" />
|
||||||
<param index="0" name="anim" type="StringName" />
|
<param index="0" name="anim" type="StringName" />
|
||||||
<description>
|
<description>
|
||||||
If [code]true[/code], the named animation exists.
|
Returns [code]true[/code] if the [param anim] animation exists.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="remove_animation">
|
<method name="remove_animation">
|
||||||
<return type="void" />
|
<return type="void" />
|
||||||
<param index="0" name="anim" type="StringName" />
|
<param index="0" name="anim" type="StringName" />
|
||||||
<description>
|
<description>
|
||||||
Removes the given animation.
|
Removes the [param anim] animation.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="remove_frame">
|
<method name="remove_frame">
|
||||||
|
@ -106,7 +105,7 @@
|
||||||
<param index="0" name="anim" type="StringName" />
|
<param index="0" name="anim" type="StringName" />
|
||||||
<param index="1" name="idx" type="int" />
|
<param index="1" name="idx" type="int" />
|
||||||
<description>
|
<description>
|
||||||
Removes the animation's selected frame.
|
Removes the [param anim] animation's frame [param idx].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="rename_animation">
|
<method name="rename_animation">
|
||||||
|
@ -114,7 +113,7 @@
|
||||||
<param index="0" name="anim" type="StringName" />
|
<param index="0" name="anim" type="StringName" />
|
||||||
<param index="1" name="newname" type="StringName" />
|
<param index="1" name="newname" type="StringName" />
|
||||||
<description>
|
<description>
|
||||||
Changes the animation's name to [param newname].
|
Changes the [param anim] animation's name to [param newname].
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_animation_loop">
|
<method name="set_animation_loop">
|
||||||
|
@ -122,7 +121,7 @@
|
||||||
<param index="0" name="anim" type="StringName" />
|
<param index="0" name="anim" type="StringName" />
|
||||||
<param index="1" name="loop" type="bool" />
|
<param index="1" name="loop" type="bool" />
|
||||||
<description>
|
<description>
|
||||||
If [code]true[/code], the animation will loop.
|
If [param loop] is [code]true[/code], the [param anim] animation will loop when it reaches the end, or the start if it is played in reverse.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="set_animation_speed">
|
<method name="set_animation_speed">
|
||||||
|
@ -140,7 +139,7 @@
|
||||||
<param index="2" name="texture" type="Texture2D" />
|
<param index="2" name="texture" type="Texture2D" />
|
||||||
<param index="3" name="duration" type="float" default="1.0" />
|
<param index="3" name="duration" type="float" default="1.0" />
|
||||||
<description>
|
<description>
|
||||||
Sets the texture and the duration of the frame [param idx] in the [param anim] animation.
|
Sets the [param texture] and the [param duration] of the frame [param idx] in the [param anim] animation.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
|
Loading…
Reference in New Issue