summaryrefslogtreecommitdiff
path: root/doc/classes/Animation.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes/Animation.xml')
-rw-r--r--doc/classes/Animation.xml26
1 files changed, 24 insertions, 2 deletions
diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml
index 0a2925e6d5..ceef16f158 100644
--- a/doc/classes/Animation.xml
+++ b/doc/classes/Animation.xml
@@ -5,7 +5,8 @@
</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.
- [codeblock]
+ [codeblocks]
+ [gdscript]
# This creates an animation that makes the node "Enemy" move to the right by
# 100 pixels in 0.5 seconds.
var animation = Animation.new()
@@ -13,7 +14,17 @@
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]
+ [/gdscript]
+ [csharp]
+ // This creates an animation that makes the node "Enemy" move to the right by
+ // 100 pixels in 0.5 seconds.
+ var animation = new Animation();
+ int trackIndex = animation.AddTrack(Animation.TrackType.Value);
+ animation.TrackSetPath(trackIndex, "Enemy:position:x");
+ animation.TrackInsertKey(trackIndex, 0.0f, 0);
+ animation.TrackInsertKey(trackIndex, 0.5f, 100);
+ [/csharp]
+ [/codeblocks]
Animations are just data containers, and must be added to nodes such as an [AnimationPlayer] to be played back. Animation tracks have different types, each with its own set of dedicated methods. Check [enum TrackType] to see available types.
</description>
<tutorials>
@@ -681,6 +692,17 @@
Sets the update mode (see [enum UpdateMode]) of a value track.
</description>
</method>
+ <method name="value_track_interpolate" qualifiers="const">
+ <return type="float">
+ </return>
+ <argument index="0" name="track_idx" type="int">
+ </argument>
+ <argument index="1" name="time_sec" type="float">
+ </argument>
+ <description>
+ Returns the interpolated value at the given time (in seconds). The [code]track_idx[/code] must be the index of a value track.
+ </description>
+ </method>
</methods>
<members>
<member name="length" type="float" setter="set_length" getter="get_length" default="1.0">