summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2018-10-03 20:35:09 +0200
committerGitHub <noreply@github.com>2018-10-03 20:35:09 +0200
commitcaa141a1ac630144e441f89689baa1a74bb3bae5 (patch)
tree7f46137a35a8f894e0b4d2f350508e7912324184
parent864772b900a81d49f5c660286ecf35b613f43412 (diff)
parenta02f02b9ed7f65a38170785be2b45983842faa56 (diff)
Merge pull request #22659 from YeldhamDev/animation_doc_example
Add example to Animation doc
-rw-r--r--doc/classes/Animation.xml11
1 files changed, 10 insertions, 1 deletions
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index 74c6796b06..bb161cd87c 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -5,7 +5,16 @@
</brief_description>
<description>
An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track.
- Animations are just data containers, and must be added to odes such as an [AnimationPlayer] or [AnimationTreePlayer] to be played back.
+ [codeblock]
+ # This creates an animation that makes the node "Enemy" move to the right by
+ # 100 pixels in 1 second.
+ var animation = Animation.new()
+ var track_index = animation.add_track(Animation.TYPE_VALUE)
+ animation.track_set_path(track_index, "Enemy:position.x")
+ animation.track_insert_key(track_index, 0.0, 0)
+ animation.track_insert_key(track_index, 0.5, 100)
+ [/codeblock]
+ Animations are just data containers, and must be added to nodes such as an [AnimationPlayer] or [AnimationTreePlayer] to be played back.
</description>
<tutorials>
<link>http://docs.godotengine.org/en/3.0/tutorials/animation/index.html</link>