Skip to content

Commit 8301ce8

Browse files
authored
Merge pull request godotengine#7238 from Piralein/animation
Update "2D Sprite Animation" Page
2 parents e7cccd8 + a61252f commit 8301ce8

15 files changed

+39
-25
lines changed

tutorials/2d/2d_sprite_animation.rst

Lines changed: 39 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,16 @@ Introduction
77
------------
88

99
In this tutorial, you'll learn how to create 2D animated
10-
characters with the AnimatedSprite2D class and the AnimationPlayer. Typically, when you create or download an animated character, it
11-
will come in one of two ways: as individual images or as a single sprite sheet
12-
containing all the animation's frames. Both can be animated in Godot with the AnimatedSprite2D class.
10+
characters with the AnimatedSprite2D class and the AnimationPlayer.
11+
Typically, when you create or download an animated character,
12+
it will come in one of two ways: as individual images or as a single sprite sheet
13+
containing all the animation's frames.
14+
Both can be animated in Godot with the AnimatedSprite2D class.
1315

1416
First, we'll use :ref:`AnimatedSprite2D <class_AnimatedSprite2D>` to
15-
animate a collection of individual images. Then we will animate a sprite sheet using this class. Finally, we will learn another way to animate a sprite sheet
17+
animate a collection of individual images.
18+
Then we will animate a sprite sheet using this class.
19+
Finally, we will learn another way to animate a sprite sheet
1620
with :ref:`AnimationPlayer <class_AnimationPlayer>` and the *Animation*
1721
property of :ref:`Sprite2D <class_Sprite2D>`.
1822

@@ -45,7 +49,7 @@ with the following nodes:
4549
Now select the ``AnimatedSprite2D`` and in its *SpriteFrames* property, select
4650
"New SpriteFrames".
4751

48-
.. image:: img/2d_animation_new_spriteframes.png
52+
.. image:: img/2d_animation_new_spriteframes.webp
4953

5054
Click on the new SpriteFrames resource and you'll see a new panel appear at the
5155
bottom of the editor window:
@@ -58,11 +62,12 @@ of the animation from "default" to "run".
5862

5963
.. image:: img/2d_animation_spriteframes_done.webp
6064

61-
Back in the Inspector, check the box for the *Playing* property. You should
62-
now see the animation playing in the viewport. However, it is a bit slow. To
63-
fix this, change the *Speed (FPS)* setting in the SpriteFrames panel to 10.
65+
Use the "Play" buttons on the top-right of the *Filter Animations* input to preview the animation.
66+
You should now see the animation playing in the viewport.
67+
However, it is a bit slow. To fix this,
68+
change the *Speed (FPS)* setting in the SpriteFrames panel to 10.
6469

65-
You can add additional animations by clicking the "New Animation" button and
70+
You can add additional animations by clicking the "Add Animation" button and
6671
adding additional images.
6772

6873
Controlling the animation
@@ -116,30 +121,37 @@ released.
116121
Sprite sheet with AnimatedSprite2D
117122
----------------------------------
118123

119-
You can also easily animate from a sprite sheet with the class ``AnimatedSprite2D``. We will use this public domain sprite sheet:
124+
You can also easily animate from a sprite sheet with the class ``AnimatedSprite2D``.
125+
We will use this public domain sprite sheet:
120126

121127
.. image:: img/2d_animation_frog_spritesheet.png
122128

123-
Right-click the image and choose "Save Image As" to download it, and then copy the image into your project folder.
129+
Right-click the image and choose "Save Image As" to download it,
130+
and then copy the image into your project folder.
124131

125-
Set up your scene tree the same way you did previously when using individual images. Select the ``AnimatedSprite2D`` and in its *SpriteFrames* property, select
126-
"New SpriteFrames".
132+
Set up your scene tree the same way you did previously when using individual images.
133+
Select the ``AnimatedSprite2D`` and in its *SpriteFrames* property, select "New SpriteFrames".
127134

128-
Click on the new SpriteFrames resource. This time, when the bottom panel appears, select "Add frames from a Sprite Sheet".
135+
Click on the new SpriteFrames resource.
136+
This time, when the bottom panel appears, select "Add frames from a Sprite Sheet".
129137

130138
.. image:: img/2d_animation_add_from_spritesheet.webp
131139

132140
You will be prompted to open a file. Select your sprite sheet.
133141

134-
A new window will open, showing your sprite sheet. The first thing you will need to do is to change the number of vertical and horizontal images in your sprite sheet. In this sprite sheet, we have four images horizontally and two images vertically.
142+
A new window will open, showing your sprite sheet.
143+
The first thing you will need to do is to change the number of vertical and horizontal images in your sprite sheet.
144+
In this sprite sheet, we have four images horizontally and two images vertically.
135145

136146
.. image:: img/2d_animation_spritesheet_select_rows.webp
137147

138-
Next, select the frames from the sprite sheet that you want to include in your animation. We will select the top four, then click "Add 4 frames" to create the animation.
148+
Next, select the frames from the sprite sheet that you want to include in your animation.
149+
We will select the top four, then click "Add 4 frames" to create the animation.
139150

140151
.. image:: img/2d_animation_spritesheet_selectframes.webp
141152

142-
You will now see your animation under the list of animations in the bottom panel. Double click on default to change the name of the animation to jump.
153+
You will now see your animation under the list of animations in the bottom panel.
154+
Double click on default to change the name of the animation to jump.
143155

144156
.. image:: img/2d_animation_spritesheet_animation.webp
145157

@@ -180,7 +192,7 @@ expand the *Animation* section in the Inspector and set the *Hframes* to ``6``.
180192
*Hframes* and *Vframes* are the number of horizontal and vertical frames in
181193
your sprite sheet.
182194

183-
.. image:: img/2d_animation_setframes.png
195+
.. image:: img/2d_animation_setframes.webp
184196

185197
Now try changing the value of the *Frame* property. You'll see that it ranges
186198
from ``0`` to ``5`` and the image displayed by the Sprite2D changes accordingly.
@@ -190,17 +202,17 @@ Select the ``AnimationPlayer`` and click the "Animation" button followed by
190202
"New". Name the new animation "walk". Set the animation length to ``0.6`` and
191203
click the "Loop" button so that our animation will repeat.
192204

193-
.. image:: img/2d_animation_new_animation.png
205+
.. image:: img/2d_animation_new_animation.webp
194206

195207
Now select the ``Sprite2D`` node and click the key icon to add a new track.
196208

197-
.. image:: img/2d_animation_new_track.png
209+
.. image:: img/2d_animation_new_track.webp
198210

199211
Continue adding frames at each point in the timeline (``0.1`` seconds by
200212
default), until you have all the frames from 0 to 5. You'll see the frames
201213
actually appearing in the animation track:
202214

203-
.. image:: img/2d_animation_full_animation.png
215+
.. image:: img/2d_animation_full_animation.webp
204216

205217
Press "Play" on the animation to see how it looks.
206218

@@ -266,7 +278,9 @@ released.
266278
Summary
267279
-------
268280

269-
These examples illustrate the two classes you can use in Godot for
270-
2D animation. ``AnimationPlayer`` is
271-
a bit more complex than ``AnimatedSprite2D``, but it provides additional functionality, since you can also
272-
animate other properties like position or scale. The class ``AnimationPlayer`` can also be used with an ``AnimatedSprite2D``. Experiment to see what works best for your needs.
281+
These examples illustrate the two classes you can use in Godot for 2D animation.
282+
``AnimationPlayer`` is a bit more complex than ``AnimatedSprite2D``,
283+
but it provides additional functionality, since you can also
284+
animate other properties like position or scale.
285+
The class ``AnimationPlayer`` can also be used with an ``AnimatedSprite2D``.
286+
Experiment to see what works best for your needs.
-454 Bytes
Loading
-13.5 KB
Binary file not shown.
14.4 KB
Loading
-9.38 KB
Binary file not shown.
9.64 KB
Loading
-12.2 KB
Binary file not shown.
11 KB
Loading
-1.18 KB
Binary file not shown.
828 Bytes
Loading

0 commit comments

Comments
 (0)