Skip to content

Commit 1ba6602

Browse files
committed
character animation
1 parent a21ad9d commit 1ba6602

33 files changed

+34
-37
lines changed

getting_started/first_3d_game/09.adding_animations.rst

Lines changed: 34 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,15 @@ nodes.
5656

5757
Set the animation duration to ``1.2`` seconds in the top-right of the dock.
5858

59-
|image7|
60-
6159
You should see the gray ribbon widen a bit. It shows you the start and end of
6260
your animation and the vertical blue line is your time cursor.
6361

64-
|image8|
62+
|image7|
6563

6664
You can click and drag the slider in the bottom-right to zoom in and out of the
6765
timeline.
6866

69-
|image9|
67+
|image8|
7068

7169
The float animation
7270
-------------------
@@ -82,23 +80,23 @@ rotation of the ``Character`` node.
8280

8381
Select the ``Character`` and in the *Inspector* expand the *Transform* section. Click the key icon next to *Position*, and *Rotation*.
8482

85-
|image10|
83+
|image9|
8684

8785
.. image:: img/09.adding_animations/curves.webp
8886

8987
For this tutorial, just create RESET Track(s) which is the default choice
9088

9189
Two tracks appear in the editor with a diamond icon representing each keyframe.
9290

93-
|image11|
91+
|image10|
9492

9593
You can click and drag on the diamonds to move them in time. Move the
9694
position key to ``0.3`` seconds and the rotation key to ``0.1`` seconds.
9795

98-
|image12|
96+
|image11|
9997

10098
Move the time cursor to ``0.5`` seconds by clicking and dragging on the gray
101-
timeline.
99+
timeline, or by entering it into the input field.
102100

103101
|timeline_05_click|
104102

@@ -108,7 +106,7 @@ In the *Inspector*, set the *Position*'s *Y* axis to ``0.65`` meters and the
108106
If you don't see the properties in the *Inspector* panel, first click on the
109107
``Character`` node again in the *Scene* dock.
110108

111-
|image13|
109+
|image12|
112110

113111
Create a keyframe for both properties
114112

@@ -117,7 +115,7 @@ Create a keyframe for both properties
117115
Now, move the position keyframe to ``0.7``
118116
seconds by dragging it on the timeline.
119117

120-
|image14|
118+
|image13|
121119

122120
.. note::
123121

@@ -136,7 +134,7 @@ create a key for both properties.
136134
You can preview the result by clicking the play button or pressing :kbd:`Shift + D`.
137135
Click the stop button or press :kbd:`S` to stop playback.
138136

139-
|image15|
137+
|image14|
140138

141139
You can see that the engine interpolates between your keyframes to produce a
142140
continuous animation. At the moment, though, the motion feels very robotic. This
@@ -147,33 +145,33 @@ We can control the transition between keyframes using easing curves.
147145

148146
Click and drag around the first two keys in the timeline to box select them.
149147

150-
|image16|
148+
|image15|
151149

152150
You can edit the properties of both keys simultaneously in the *Inspector*,
153151
where you can see an *Easing* property.
154152

155-
|image17|
153+
|image16|
156154

157155
Click and drag on the curve, pulling it towards the left. This will make it
158156
ease-out, that is to say, transition fast initially and slow down as the time
159157
cursor reaches the next keyframe.
160158

161-
|image18|
159+
|image17|
162160

163161
Play the animation again to see the difference. The first half should already
164162
feel a bit bouncier.
165163

166164
Apply an ease-out to the second keyframe in the rotation track.
167165

168-
|image19|
166+
|image18|
169167

170168
Do the opposite for the second position keyframe, dragging it to the right.
171169

172-
|image20|
170+
|image19|
173171

174172
Your animation should look something like this.
175173

176-
|image21|
174+
|image20|
177175

178176
.. note::
179177

@@ -197,7 +195,7 @@ Let's change the animation speed when the character is moving.
197195

198196
Open the ``Player``'s script by clicking the script icon next to it.
199197

200-
|image22|
198+
|image21|
201199

202200
In ``_physics_process()``, after the line where we check the ``direction``
203201
vector, add the following code.
@@ -618,26 +616,25 @@ And the *Mob*'s script.
618616
.. |image0| image:: img/squash-the-creeps-final.gif
619617
.. |image1| image:: img/09.adding_animations/animation_player_dock.webp
620618
.. |image2| image:: img/09.adding_animations/02.new_animation.webp
621-
.. |image3| image:: img/09.adding_animations/03.float_name.png
622-
.. |image4| image:: img/09.adding_animations/03.timeline.png
623-
.. |image5| image:: img/09.adding_animations/04.autoplay_and_loop.png
624-
.. |image6| image:: img/09.adding_animations/05.pin_icon.png
619+
.. |image3| image:: img/09.adding_animations/03.float_name.webp
620+
.. |image4| image:: img/09.adding_animations/03.timeline.webp
621+
.. |image5| image:: img/09.adding_animations/04.autoplay_and_loop.webp
622+
.. |image6| image:: img/09.adding_animations/05.pin_icon.webp
625623
.. |image7| image:: img/09.adding_animations/06.animation_duration.webp
626-
.. |image8| image:: img/09.adding_animations/07.editable_timeline.webp
627-
.. |image9| image:: img/09.adding_animations/08.zoom_slider.webp
628-
.. |image10| image:: img/09.adding_animations/09.creating_first_keyframe.webp
629-
.. |image11| image:: img/09.adding_animations/10.initial_keys.webp
630-
.. |image12| image:: img/09.adding_animations/11.moving_keys.webp
631-
.. |image13| image:: img/09.adding_animations/12.second_keys_values.webp
632-
.. |image14| image:: img/09.adding_animations/13.second_keys.webp
633-
.. |image15| image:: img/09.adding_animations/14.play_button.png
634-
.. |image16| image:: img/09.adding_animations/15.box_select.webp
635-
.. |image17| image:: img/09.adding_animations/16.easing_property.png
636-
.. |image18| image:: img/09.adding_animations/17.ease_out.png
637-
.. |image19| image:: img/09.adding_animations/18.ease_out_second_rotation_key.png
638-
.. |image20| image:: img/09.adding_animations/19.ease_in_second_translation_key.png
639-
.. |image21| image:: img/09.adding_animations/20.float_animation.gif
640-
.. |image22| image:: img/09.adding_animations/21.script_icon.png
624+
.. |image8| image:: img/09.adding_animations/08.zoom_slider.webp
625+
.. |image9| image:: img/09.adding_animations/09.creating_first_keyframe.webp
626+
.. |image10| image:: img/09.adding_animations/10.initial_keys.webp
627+
.. |image11| image:: img/09.adding_animations/11.moving_keys.webp
628+
.. |image12| image:: img/09.adding_animations/12.second_keys_values.webp
629+
.. |image13| image:: img/09.adding_animations/13.second_keys.webp
630+
.. |image14| image:: img/09.adding_animations/14.play_button.webp
631+
.. |image15| image:: img/09.adding_animations/15.box_select.webp
632+
.. |image16| image:: img/09.adding_animations/16.easing_property.webp
633+
.. |image17| image:: img/09.adding_animations/17.ease_out.webp
634+
.. |image18| image:: img/09.adding_animations/18.ease_out_second_rotation_key.webp
635+
.. |image19| image:: img/09.adding_animations/19.ease_in_second_translation_key.webp
636+
.. |image20| image:: img/09.adding_animations/20.float_animation.gif
637+
.. |image21| image:: img/09.adding_animations/21.script_icon.webp
641638
.. |animation_final_keyframes| image:: img/09.adding_animations/animation_final_keyframes.webp
642639
.. |second_keys_both| image:: img/09.adding_animations/second_keys_both.webp
643640
.. |timeline_05_click| image:: img/09.adding_animations/timeline_05_click.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)