Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/doc/classes/Animation.xml
10277 views
1
<?xml version="1.0" encoding="UTF-8" ?>
2
<class name="Animation" inherits="Resource" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3
<brief_description>
4
Holds data that can be used to animate anything in the engine.
5
</brief_description>
6
<description>
7
This resource holds data that can be used to animate anything 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.
8
[codeblocks]
9
[gdscript]
10
# This creates an animation that makes the node "Enemy" move to the right by
11
# 100 pixels in 2.0 seconds.
12
var animation = Animation.new()
13
var track_index = animation.add_track(Animation.TYPE_VALUE)
14
animation.track_set_path(track_index, "Enemy:position:x")
15
animation.track_insert_key(track_index, 0.0, 0)
16
animation.track_insert_key(track_index, 2.0, 100)
17
animation.length = 2.0
18
[/gdscript]
19
[csharp]
20
// This creates an animation that makes the node "Enemy" move to the right by
21
// 100 pixels in 2.0 seconds.
22
var animation = new Animation();
23
int trackIndex = animation.AddTrack(Animation.TrackType.Value);
24
animation.TrackSetPath(trackIndex, "Enemy:position:x");
25
animation.TrackInsertKey(trackIndex, 0.0f, 0);
26
animation.TrackInsertKey(trackIndex, 2.0f, 100);
27
animation.Length = 2.0f;
28
[/csharp]
29
[/codeblocks]
30
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.
31
[b]Note:[/b] For 3D position/rotation/scale, using the dedicated [constant TYPE_POSITION_3D], [constant TYPE_ROTATION_3D] and [constant TYPE_SCALE_3D] track types instead of [constant TYPE_VALUE] is recommended for performance reasons.
32
</description>
33
<tutorials>
34
<link title="Animation documentation index">$DOCS_URL/tutorials/animation/index.html</link>
35
</tutorials>
36
<methods>
37
<method name="add_marker">
38
<return type="void" />
39
<param index="0" name="name" type="StringName" />
40
<param index="1" name="time" type="float" />
41
<description>
42
Adds a marker to this Animation.
43
</description>
44
</method>
45
<method name="add_track">
46
<return type="int" />
47
<param index="0" name="type" type="int" enum="Animation.TrackType" />
48
<param index="1" name="at_position" type="int" default="-1" />
49
<description>
50
Adds a track to the Animation.
51
</description>
52
</method>
53
<method name="animation_track_get_key_animation" qualifiers="const">
54
<return type="StringName" />
55
<param index="0" name="track_idx" type="int" />
56
<param index="1" name="key_idx" type="int" />
57
<description>
58
Returns the animation name at the key identified by [param key_idx]. The [param track_idx] must be the index of an Animation Track.
59
</description>
60
</method>
61
<method name="animation_track_insert_key">
62
<return type="int" />
63
<param index="0" name="track_idx" type="int" />
64
<param index="1" name="time" type="float" />
65
<param index="2" name="animation" type="StringName" />
66
<description>
67
Inserts a key with value [param animation] at the given [param time] (in seconds). The [param track_idx] must be the index of an Animation Track.
68
</description>
69
</method>
70
<method name="animation_track_set_key_animation">
71
<return type="void" />
72
<param index="0" name="track_idx" type="int" />
73
<param index="1" name="key_idx" type="int" />
74
<param index="2" name="animation" type="StringName" />
75
<description>
76
Sets the key identified by [param key_idx] to value [param animation]. The [param track_idx] must be the index of an Animation Track.
77
</description>
78
</method>
79
<method name="audio_track_get_key_end_offset" qualifiers="const">
80
<return type="float" />
81
<param index="0" name="track_idx" type="int" />
82
<param index="1" name="key_idx" type="int" />
83
<description>
84
Returns the end offset of the key identified by [param key_idx]. The [param track_idx] must be the index of an Audio Track.
85
End offset is the number of seconds cut off at the ending of the audio stream.
86
</description>
87
</method>
88
<method name="audio_track_get_key_start_offset" qualifiers="const">
89
<return type="float" />
90
<param index="0" name="track_idx" type="int" />
91
<param index="1" name="key_idx" type="int" />
92
<description>
93
Returns the start offset of the key identified by [param key_idx]. The [param track_idx] must be the index of an Audio Track.
94
Start offset is the number of seconds cut off at the beginning of the audio stream.
95
</description>
96
</method>
97
<method name="audio_track_get_key_stream" qualifiers="const">
98
<return type="Resource" />
99
<param index="0" name="track_idx" type="int" />
100
<param index="1" name="key_idx" type="int" />
101
<description>
102
Returns the audio stream of the key identified by [param key_idx]. The [param track_idx] must be the index of an Audio Track.
103
</description>
104
</method>
105
<method name="audio_track_insert_key">
106
<return type="int" />
107
<param index="0" name="track_idx" type="int" />
108
<param index="1" name="time" type="float" />
109
<param index="2" name="stream" type="Resource" />
110
<param index="3" name="start_offset" type="float" default="0" />
111
<param index="4" name="end_offset" type="float" default="0" />
112
<description>
113
Inserts an Audio Track key at the given [param time] in seconds. The [param track_idx] must be the index of an Audio Track.
114
[param stream] is the [AudioStream] resource to play. [param start_offset] is the number of seconds cut off at the beginning of the audio stream, while [param end_offset] is at the ending.
115
</description>
116
</method>
117
<method name="audio_track_is_use_blend" qualifiers="const">
118
<return type="bool" />
119
<param index="0" name="track_idx" type="int" />
120
<description>
121
Returns [code]true[/code] if the track at [param track_idx] will be blended with other animations.
122
</description>
123
</method>
124
<method name="audio_track_set_key_end_offset">
125
<return type="void" />
126
<param index="0" name="track_idx" type="int" />
127
<param index="1" name="key_idx" type="int" />
128
<param index="2" name="offset" type="float" />
129
<description>
130
Sets the end offset of the key identified by [param key_idx] to value [param offset]. The [param track_idx] must be the index of an Audio Track.
131
</description>
132
</method>
133
<method name="audio_track_set_key_start_offset">
134
<return type="void" />
135
<param index="0" name="track_idx" type="int" />
136
<param index="1" name="key_idx" type="int" />
137
<param index="2" name="offset" type="float" />
138
<description>
139
Sets the start offset of the key identified by [param key_idx] to value [param offset]. The [param track_idx] must be the index of an Audio Track.
140
</description>
141
</method>
142
<method name="audio_track_set_key_stream">
143
<return type="void" />
144
<param index="0" name="track_idx" type="int" />
145
<param index="1" name="key_idx" type="int" />
146
<param index="2" name="stream" type="Resource" />
147
<description>
148
Sets the stream of the key identified by [param key_idx] to value [param stream]. The [param track_idx] must be the index of an Audio Track.
149
</description>
150
</method>
151
<method name="audio_track_set_use_blend">
152
<return type="void" />
153
<param index="0" name="track_idx" type="int" />
154
<param index="1" name="enable" type="bool" />
155
<description>
156
Sets whether the track will be blended with other animations. If [code]true[/code], the audio playback volume changes depending on the blend value.
157
</description>
158
</method>
159
<method name="bezier_track_get_key_in_handle" qualifiers="const">
160
<return type="Vector2" />
161
<param index="0" name="track_idx" type="int" />
162
<param index="1" name="key_idx" type="int" />
163
<description>
164
Returns the in handle of the key identified by [param key_idx]. The [param track_idx] must be the index of a Bezier Track.
165
</description>
166
</method>
167
<method name="bezier_track_get_key_out_handle" qualifiers="const">
168
<return type="Vector2" />
169
<param index="0" name="track_idx" type="int" />
170
<param index="1" name="key_idx" type="int" />
171
<description>
172
Returns the out handle of the key identified by [param key_idx]. The [param track_idx] must be the index of a Bezier Track.
173
</description>
174
</method>
175
<method name="bezier_track_get_key_value" qualifiers="const">
176
<return type="float" />
177
<param index="0" name="track_idx" type="int" />
178
<param index="1" name="key_idx" type="int" />
179
<description>
180
Returns the value of the key identified by [param key_idx]. The [param track_idx] must be the index of a Bezier Track.
181
</description>
182
</method>
183
<method name="bezier_track_insert_key">
184
<return type="int" />
185
<param index="0" name="track_idx" type="int" />
186
<param index="1" name="time" type="float" />
187
<param index="2" name="value" type="float" />
188
<param index="3" name="in_handle" type="Vector2" default="Vector2(0, 0)" />
189
<param index="4" name="out_handle" type="Vector2" default="Vector2(0, 0)" />
190
<description>
191
Inserts a Bezier Track key at the given [param time] in seconds. The [param track_idx] must be the index of a Bezier Track.
192
[param in_handle] is the left-side weight of the added Bezier curve point, [param out_handle] is the right-side one, while [param value] is the actual value at this point.
193
</description>
194
</method>
195
<method name="bezier_track_interpolate" qualifiers="const">
196
<return type="float" />
197
<param index="0" name="track_idx" type="int" />
198
<param index="1" name="time" type="float" />
199
<description>
200
Returns the interpolated value at the given [param time] (in seconds). The [param track_idx] must be the index of a Bezier Track.
201
</description>
202
</method>
203
<method name="bezier_track_set_key_in_handle">
204
<return type="void" />
205
<param index="0" name="track_idx" type="int" />
206
<param index="1" name="key_idx" type="int" />
207
<param index="2" name="in_handle" type="Vector2" />
208
<param index="3" name="balanced_value_time_ratio" type="float" default="1.0" />
209
<description>
210
Sets the in handle of the key identified by [param key_idx] to value [param in_handle]. The [param track_idx] must be the index of a Bezier Track.
211
</description>
212
</method>
213
<method name="bezier_track_set_key_out_handle">
214
<return type="void" />
215
<param index="0" name="track_idx" type="int" />
216
<param index="1" name="key_idx" type="int" />
217
<param index="2" name="out_handle" type="Vector2" />
218
<param index="3" name="balanced_value_time_ratio" type="float" default="1.0" />
219
<description>
220
Sets the out handle of the key identified by [param key_idx] to value [param out_handle]. The [param track_idx] must be the index of a Bezier Track.
221
</description>
222
</method>
223
<method name="bezier_track_set_key_value">
224
<return type="void" />
225
<param index="0" name="track_idx" type="int" />
226
<param index="1" name="key_idx" type="int" />
227
<param index="2" name="value" type="float" />
228
<description>
229
Sets the value of the key identified by [param key_idx] to the given value. The [param track_idx] must be the index of a Bezier Track.
230
</description>
231
</method>
232
<method name="blend_shape_track_insert_key">
233
<return type="int" />
234
<param index="0" name="track_idx" type="int" />
235
<param index="1" name="time" type="float" />
236
<param index="2" name="amount" type="float" />
237
<description>
238
Inserts a key in a given blend shape track. Returns the key index.
239
</description>
240
</method>
241
<method name="blend_shape_track_interpolate" qualifiers="const">
242
<return type="float" />
243
<param index="0" name="track_idx" type="int" />
244
<param index="1" name="time_sec" type="float" />
245
<param index="2" name="backward" type="bool" default="false" />
246
<description>
247
Returns the interpolated blend shape value at the given time (in seconds). The [param track_idx] must be the index of a blend shape track.
248
</description>
249
</method>
250
<method name="clear">
251
<return type="void" />
252
<description>
253
Clear the animation (clear all tracks and reset all).
254
</description>
255
</method>
256
<method name="compress">
257
<return type="void" />
258
<param index="0" name="page_size" type="int" default="8192" />
259
<param index="1" name="fps" type="int" default="120" />
260
<param index="2" name="split_tolerance" type="float" default="4.0" />
261
<description>
262
Compress the animation and all its tracks in-place. This will make [method track_is_compressed] return [code]true[/code] once called on this [Animation]. Compressed tracks require less memory to be played, and are designed to be used for complex 3D animations (such as cutscenes) imported from external 3D software. Compression is lossy, but the difference is usually not noticeable in real world conditions.
263
[b]Note:[/b] Compressed tracks have various limitations (such as not being editable from the editor), so only use compressed animations if you actually need them.
264
</description>
265
</method>
266
<method name="copy_track">
267
<return type="void" />
268
<param index="0" name="track_idx" type="int" />
269
<param index="1" name="to_animation" type="Animation" />
270
<description>
271
Adds a new track to [param to_animation] that is a copy of the given track from this animation.
272
</description>
273
</method>
274
<method name="find_track" qualifiers="const">
275
<return type="int" />
276
<param index="0" name="path" type="NodePath" />
277
<param index="1" name="type" type="int" enum="Animation.TrackType" />
278
<description>
279
Returns the index of the specified track. If the track is not found, return -1.
280
</description>
281
</method>
282
<method name="get_marker_at_time" qualifiers="const">
283
<return type="StringName" />
284
<param index="0" name="time" type="float" />
285
<description>
286
Returns the name of the marker located at the given time.
287
</description>
288
</method>
289
<method name="get_marker_color" qualifiers="const">
290
<return type="Color" />
291
<param index="0" name="name" type="StringName" />
292
<description>
293
Returns the given marker's color.
294
</description>
295
</method>
296
<method name="get_marker_names" qualifiers="const">
297
<return type="PackedStringArray" />
298
<description>
299
Returns every marker in this Animation, sorted ascending by time.
300
</description>
301
</method>
302
<method name="get_marker_time" qualifiers="const">
303
<return type="float" />
304
<param index="0" name="name" type="StringName" />
305
<description>
306
Returns the given marker's time.
307
</description>
308
</method>
309
<method name="get_next_marker" qualifiers="const">
310
<return type="StringName" />
311
<param index="0" name="time" type="float" />
312
<description>
313
Returns the closest marker that comes after the given time. If no such marker exists, an empty string is returned.
314
</description>
315
</method>
316
<method name="get_prev_marker" qualifiers="const">
317
<return type="StringName" />
318
<param index="0" name="time" type="float" />
319
<description>
320
Returns the closest marker that comes before the given time. If no such marker exists, an empty string is returned.
321
</description>
322
</method>
323
<method name="get_track_count" qualifiers="const">
324
<return type="int" />
325
<description>
326
Returns the amount of tracks in the animation.
327
</description>
328
</method>
329
<method name="has_marker" qualifiers="const">
330
<return type="bool" />
331
<param index="0" name="name" type="StringName" />
332
<description>
333
Returns [code]true[/code] if this Animation contains a marker with the given name.
334
</description>
335
</method>
336
<method name="method_track_get_name" qualifiers="const">
337
<return type="StringName" />
338
<param index="0" name="track_idx" type="int" />
339
<param index="1" name="key_idx" type="int" />
340
<description>
341
Returns the method name of a method track.
342
</description>
343
</method>
344
<method name="method_track_get_params" qualifiers="const">
345
<return type="Array" />
346
<param index="0" name="track_idx" type="int" />
347
<param index="1" name="key_idx" type="int" />
348
<description>
349
Returns the arguments values to be called on a method track for a given key in a given track.
350
</description>
351
</method>
352
<method name="optimize">
353
<return type="void" />
354
<param index="0" name="allowed_velocity_err" type="float" default="0.01" />
355
<param index="1" name="allowed_angular_err" type="float" default="0.01" />
356
<param index="2" name="precision" type="int" default="3" />
357
<description>
358
Optimize the animation and all its tracks in-place. This will preserve only as many keys as are necessary to keep the animation within the specified bounds.
359
</description>
360
</method>
361
<method name="position_track_insert_key">
362
<return type="int" />
363
<param index="0" name="track_idx" type="int" />
364
<param index="1" name="time" type="float" />
365
<param index="2" name="position" type="Vector3" />
366
<description>
367
Inserts a key in a given 3D position track. Returns the key index.
368
</description>
369
</method>
370
<method name="position_track_interpolate" qualifiers="const">
371
<return type="Vector3" />
372
<param index="0" name="track_idx" type="int" />
373
<param index="1" name="time_sec" type="float" />
374
<param index="2" name="backward" type="bool" default="false" />
375
<description>
376
Returns the interpolated position value at the given time (in seconds). The [param track_idx] must be the index of a 3D position track.
377
</description>
378
</method>
379
<method name="remove_marker">
380
<return type="void" />
381
<param index="0" name="name" type="StringName" />
382
<description>
383
Removes the marker with the given name from this Animation.
384
</description>
385
</method>
386
<method name="remove_track">
387
<return type="void" />
388
<param index="0" name="track_idx" type="int" />
389
<description>
390
Removes a track by specifying the track index.
391
</description>
392
</method>
393
<method name="rotation_track_insert_key">
394
<return type="int" />
395
<param index="0" name="track_idx" type="int" />
396
<param index="1" name="time" type="float" />
397
<param index="2" name="rotation" type="Quaternion" />
398
<description>
399
Inserts a key in a given 3D rotation track. Returns the key index.
400
</description>
401
</method>
402
<method name="rotation_track_interpolate" qualifiers="const">
403
<return type="Quaternion" />
404
<param index="0" name="track_idx" type="int" />
405
<param index="1" name="time_sec" type="float" />
406
<param index="2" name="backward" type="bool" default="false" />
407
<description>
408
Returns the interpolated rotation value at the given time (in seconds). The [param track_idx] must be the index of a 3D rotation track.
409
</description>
410
</method>
411
<method name="scale_track_insert_key">
412
<return type="int" />
413
<param index="0" name="track_idx" type="int" />
414
<param index="1" name="time" type="float" />
415
<param index="2" name="scale" type="Vector3" />
416
<description>
417
Inserts a key in a given 3D scale track. Returns the key index.
418
</description>
419
</method>
420
<method name="scale_track_interpolate" qualifiers="const">
421
<return type="Vector3" />
422
<param index="0" name="track_idx" type="int" />
423
<param index="1" name="time_sec" type="float" />
424
<param index="2" name="backward" type="bool" default="false" />
425
<description>
426
Returns the interpolated scale value at the given time (in seconds). The [param track_idx] must be the index of a 3D scale track.
427
</description>
428
</method>
429
<method name="set_marker_color">
430
<return type="void" />
431
<param index="0" name="name" type="StringName" />
432
<param index="1" name="color" type="Color" />
433
<description>
434
Sets the given marker's color.
435
</description>
436
</method>
437
<method name="track_find_key" qualifiers="const">
438
<return type="int" />
439
<param index="0" name="track_idx" type="int" />
440
<param index="1" name="time" type="float" />
441
<param index="2" name="find_mode" type="int" enum="Animation.FindMode" default="0" />
442
<param index="3" name="limit" type="bool" default="false" />
443
<param index="4" name="backward" type="bool" default="false" />
444
<description>
445
Finds the key index by time in a given track. Optionally, only find it if the approx/exact time is given.
446
If [param limit] is [code]true[/code], it does not return keys outside the animation range.
447
If [param backward] is [code]true[/code], the direction is reversed in methods that rely on one directional processing.
448
For example, in case [param find_mode] is [constant FIND_MODE_NEAREST], if there is no key in the current position just after seeked, the first key found is retrieved by searching before the position, but if [param backward] is [code]true[/code], the first key found is retrieved after the position.
449
</description>
450
</method>
451
<method name="track_get_interpolation_loop_wrap" qualifiers="const">
452
<return type="bool" />
453
<param index="0" name="track_idx" type="int" />
454
<description>
455
Returns [code]true[/code] if the track at [param track_idx] wraps the interpolation loop. New tracks wrap the interpolation loop by default.
456
</description>
457
</method>
458
<method name="track_get_interpolation_type" qualifiers="const">
459
<return type="int" enum="Animation.InterpolationType" />
460
<param index="0" name="track_idx" type="int" />
461
<description>
462
Returns the interpolation type of a given track.
463
</description>
464
</method>
465
<method name="track_get_key_count" qualifiers="const">
466
<return type="int" />
467
<param index="0" name="track_idx" type="int" />
468
<description>
469
Returns the number of keys in a given track.
470
</description>
471
</method>
472
<method name="track_get_key_time" qualifiers="const">
473
<return type="float" />
474
<param index="0" name="track_idx" type="int" />
475
<param index="1" name="key_idx" type="int" />
476
<description>
477
Returns the time at which the key is located.
478
</description>
479
</method>
480
<method name="track_get_key_transition" qualifiers="const">
481
<return type="float" />
482
<param index="0" name="track_idx" type="int" />
483
<param index="1" name="key_idx" type="int" />
484
<description>
485
Returns the transition curve (easing) for a specific key (see the built-in math function [method @GlobalScope.ease]).
486
</description>
487
</method>
488
<method name="track_get_key_value" qualifiers="const">
489
<return type="Variant" />
490
<param index="0" name="track_idx" type="int" />
491
<param index="1" name="key_idx" type="int" />
492
<description>
493
Returns the value of a given key in a given track.
494
</description>
495
</method>
496
<method name="track_get_path" qualifiers="const">
497
<return type="NodePath" />
498
<param index="0" name="track_idx" type="int" />
499
<description>
500
Gets the path of a track. For more information on the path format, see [method track_set_path].
501
</description>
502
</method>
503
<method name="track_get_type" qualifiers="const">
504
<return type="int" enum="Animation.TrackType" />
505
<param index="0" name="track_idx" type="int" />
506
<description>
507
Gets the type of a track.
508
</description>
509
</method>
510
<method name="track_insert_key">
511
<return type="int" />
512
<param index="0" name="track_idx" type="int" />
513
<param index="1" name="time" type="float" />
514
<param index="2" name="key" type="Variant" />
515
<param index="3" name="transition" type="float" default="1" />
516
<description>
517
Inserts a generic key in a given track. Returns the key index.
518
</description>
519
</method>
520
<method name="track_is_compressed" qualifiers="const">
521
<return type="bool" />
522
<param index="0" name="track_idx" type="int" />
523
<description>
524
Returns [code]true[/code] if the track is compressed, [code]false[/code] otherwise. See also [method compress].
525
</description>
526
</method>
527
<method name="track_is_enabled" qualifiers="const">
528
<return type="bool" />
529
<param index="0" name="track_idx" type="int" />
530
<description>
531
Returns [code]true[/code] if the track at index [param track_idx] is enabled.
532
</description>
533
</method>
534
<method name="track_is_imported" qualifiers="const">
535
<return type="bool" />
536
<param index="0" name="track_idx" type="int" />
537
<description>
538
Returns [code]true[/code] if the given track is imported. Else, return [code]false[/code].
539
</description>
540
</method>
541
<method name="track_move_down">
542
<return type="void" />
543
<param index="0" name="track_idx" type="int" />
544
<description>
545
Moves a track down.
546
</description>
547
</method>
548
<method name="track_move_to">
549
<return type="void" />
550
<param index="0" name="track_idx" type="int" />
551
<param index="1" name="to_idx" type="int" />
552
<description>
553
Changes the index position of track [param track_idx] to the one defined in [param to_idx].
554
</description>
555
</method>
556
<method name="track_move_up">
557
<return type="void" />
558
<param index="0" name="track_idx" type="int" />
559
<description>
560
Moves a track up.
561
</description>
562
</method>
563
<method name="track_remove_key">
564
<return type="void" />
565
<param index="0" name="track_idx" type="int" />
566
<param index="1" name="key_idx" type="int" />
567
<description>
568
Removes a key by index in a given track.
569
</description>
570
</method>
571
<method name="track_remove_key_at_time">
572
<return type="void" />
573
<param index="0" name="track_idx" type="int" />
574
<param index="1" name="time" type="float" />
575
<description>
576
Removes a key at [param time] in a given track.
577
</description>
578
</method>
579
<method name="track_set_enabled">
580
<return type="void" />
581
<param index="0" name="track_idx" type="int" />
582
<param index="1" name="enabled" type="bool" />
583
<description>
584
Enables/disables the given track. Tracks are enabled by default.
585
</description>
586
</method>
587
<method name="track_set_imported">
588
<return type="void" />
589
<param index="0" name="track_idx" type="int" />
590
<param index="1" name="imported" type="bool" />
591
<description>
592
Sets the given track as imported or not.
593
</description>
594
</method>
595
<method name="track_set_interpolation_loop_wrap">
596
<return type="void" />
597
<param index="0" name="track_idx" type="int" />
598
<param index="1" name="interpolation" type="bool" />
599
<description>
600
If [code]true[/code], the track at [param track_idx] wraps the interpolation loop.
601
</description>
602
</method>
603
<method name="track_set_interpolation_type">
604
<return type="void" />
605
<param index="0" name="track_idx" type="int" />
606
<param index="1" name="interpolation" type="int" enum="Animation.InterpolationType" />
607
<description>
608
Sets the interpolation type of a given track.
609
</description>
610
</method>
611
<method name="track_set_key_time">
612
<return type="void" />
613
<param index="0" name="track_idx" type="int" />
614
<param index="1" name="key_idx" type="int" />
615
<param index="2" name="time" type="float" />
616
<description>
617
Sets the time of an existing key.
618
</description>
619
</method>
620
<method name="track_set_key_transition">
621
<return type="void" />
622
<param index="0" name="track_idx" type="int" />
623
<param index="1" name="key_idx" type="int" />
624
<param index="2" name="transition" type="float" />
625
<description>
626
Sets the transition curve (easing) for a specific key (see the built-in math function [method @GlobalScope.ease]).
627
</description>
628
</method>
629
<method name="track_set_key_value">
630
<return type="void" />
631
<param index="0" name="track_idx" type="int" />
632
<param index="1" name="key" type="int" />
633
<param index="2" name="value" type="Variant" />
634
<description>
635
Sets the value of an existing key.
636
</description>
637
</method>
638
<method name="track_set_path">
639
<return type="void" />
640
<param index="0" name="track_idx" type="int" />
641
<param index="1" name="path" type="NodePath" />
642
<description>
643
Sets the path of a track. Paths must be valid scene-tree paths to a node and must be specified starting from the [member AnimationMixer.root_node] that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by [code]":"[/code].
644
For example, [code]"character/skeleton:ankle"[/code] or [code]"character/mesh:transform/local"[/code].
645
</description>
646
</method>
647
<method name="track_swap">
648
<return type="void" />
649
<param index="0" name="track_idx" type="int" />
650
<param index="1" name="with_idx" type="int" />
651
<description>
652
Swaps the track [param track_idx]'s index position with the track [param with_idx].
653
</description>
654
</method>
655
<method name="value_track_get_update_mode" qualifiers="const">
656
<return type="int" enum="Animation.UpdateMode" />
657
<param index="0" name="track_idx" type="int" />
658
<description>
659
Returns the update mode of a value track.
660
</description>
661
</method>
662
<method name="value_track_interpolate" qualifiers="const">
663
<return type="Variant" />
664
<param index="0" name="track_idx" type="int" />
665
<param index="1" name="time_sec" type="float" />
666
<param index="2" name="backward" type="bool" default="false" />
667
<description>
668
Returns the interpolated value at the given time (in seconds). The [param track_idx] must be the index of a value track.
669
A [param backward] mainly affects the direction of key retrieval of the track with [constant UPDATE_DISCRETE] converted by [constant AnimationMixer.ANIMATION_CALLBACK_MODE_DISCRETE_FORCE_CONTINUOUS] to match the result with [method track_find_key].
670
</description>
671
</method>
672
<method name="value_track_set_update_mode">
673
<return type="void" />
674
<param index="0" name="track_idx" type="int" />
675
<param index="1" name="mode" type="int" enum="Animation.UpdateMode" />
676
<description>
677
Sets the update mode of a value track.
678
</description>
679
</method>
680
</methods>
681
<members>
682
<member name="capture_included" type="bool" setter="" getter="is_capture_included" default="false">
683
Returns [code]true[/code] if the capture track is included. This is a cached readonly value for performance.
684
</member>
685
<member name="length" type="float" setter="set_length" getter="get_length" default="1.0">
686
The total length of the animation (in seconds).
687
[b]Note:[/b] Length is not delimited by the last key, as this one may be before or after the end to ensure correct interpolation and looping.
688
</member>
689
<member name="loop_mode" type="int" setter="set_loop_mode" getter="get_loop_mode" enum="Animation.LoopMode" default="0">
690
Determines the behavior of both ends of the animation timeline during animation playback. This indicates whether and how the animation should be restarted, and is also used to correctly interpolate animation cycles.
691
</member>
692
<member name="step" type="float" setter="set_step" getter="get_step" default="0.033333335">
693
The animation step value.
694
</member>
695
</members>
696
<constants>
697
<constant name="TYPE_VALUE" value="0" enum="TrackType">
698
Value tracks set values in node properties, but only those which can be interpolated. For 3D position/rotation/scale, using the dedicated [constant TYPE_POSITION_3D], [constant TYPE_ROTATION_3D] and [constant TYPE_SCALE_3D] track types instead of [constant TYPE_VALUE] is recommended for performance reasons.
699
</constant>
700
<constant name="TYPE_POSITION_3D" value="1" enum="TrackType">
701
3D position track (values are stored in [Vector3]s).
702
</constant>
703
<constant name="TYPE_ROTATION_3D" value="2" enum="TrackType">
704
3D rotation track (values are stored in [Quaternion]s).
705
</constant>
706
<constant name="TYPE_SCALE_3D" value="3" enum="TrackType">
707
3D scale track (values are stored in [Vector3]s).
708
</constant>
709
<constant name="TYPE_BLEND_SHAPE" value="4" enum="TrackType">
710
Blend shape track.
711
</constant>
712
<constant name="TYPE_METHOD" value="5" enum="TrackType">
713
Method tracks call functions with given arguments per key.
714
</constant>
715
<constant name="TYPE_BEZIER" value="6" enum="TrackType">
716
Bezier tracks are used to interpolate a value using custom curves. They can also be used to animate sub-properties of vectors and colors (e.g. alpha value of a [Color]).
717
</constant>
718
<constant name="TYPE_AUDIO" value="7" enum="TrackType">
719
Audio tracks are used to play an audio stream with either type of [AudioStreamPlayer]. The stream can be trimmed and previewed in the animation.
720
</constant>
721
<constant name="TYPE_ANIMATION" value="8" enum="TrackType">
722
Animation tracks play animations in other [AnimationPlayer] nodes.
723
</constant>
724
<constant name="INTERPOLATION_NEAREST" value="0" enum="InterpolationType">
725
No interpolation (nearest value).
726
</constant>
727
<constant name="INTERPOLATION_LINEAR" value="1" enum="InterpolationType">
728
Linear interpolation.
729
</constant>
730
<constant name="INTERPOLATION_CUBIC" value="2" enum="InterpolationType">
731
Cubic interpolation. This looks smoother than linear interpolation, but is more expensive to interpolate. Stick to [constant INTERPOLATION_LINEAR] for complex 3D animations imported from external software, even if it requires using a higher animation framerate in return.
732
</constant>
733
<constant name="INTERPOLATION_LINEAR_ANGLE" value="3" enum="InterpolationType">
734
Linear interpolation with shortest path rotation.
735
[b]Note:[/b] The result value is always normalized and may not match the key value.
736
</constant>
737
<constant name="INTERPOLATION_CUBIC_ANGLE" value="4" enum="InterpolationType">
738
Cubic interpolation with shortest path rotation.
739
[b]Note:[/b] The result value is always normalized and may not match the key value.
740
</constant>
741
<constant name="UPDATE_CONTINUOUS" value="0" enum="UpdateMode">
742
Update between keyframes and hold the value.
743
</constant>
744
<constant name="UPDATE_DISCRETE" value="1" enum="UpdateMode">
745
Update at the keyframes.
746
</constant>
747
<constant name="UPDATE_CAPTURE" value="2" enum="UpdateMode">
748
Same as [constant UPDATE_CONTINUOUS] but works as a flag to capture the value of the current object and perform interpolation in some methods. See also [method AnimationMixer.capture], [member AnimationPlayer.playback_auto_capture], and [method AnimationPlayer.play_with_capture].
749
</constant>
750
<constant name="LOOP_NONE" value="0" enum="LoopMode">
751
At both ends of the animation, the animation will stop playing.
752
</constant>
753
<constant name="LOOP_LINEAR" value="1" enum="LoopMode">
754
At both ends of the animation, the animation will be repeated without changing the playback direction.
755
</constant>
756
<constant name="LOOP_PINGPONG" value="2" enum="LoopMode">
757
Repeats playback and reverse playback at both ends of the animation.
758
</constant>
759
<constant name="LOOPED_FLAG_NONE" value="0" enum="LoopedFlag">
760
This flag indicates that the animation proceeds without any looping.
761
</constant>
762
<constant name="LOOPED_FLAG_END" value="1" enum="LoopedFlag">
763
This flag indicates that the animation has reached the end of the animation and just after loop processed.
764
</constant>
765
<constant name="LOOPED_FLAG_START" value="2" enum="LoopedFlag">
766
This flag indicates that the animation has reached the start of the animation and just after loop processed.
767
</constant>
768
<constant name="FIND_MODE_NEAREST" value="0" enum="FindMode">
769
Finds the nearest time key.
770
</constant>
771
<constant name="FIND_MODE_APPROX" value="1" enum="FindMode">
772
Finds only the key with approximating the time.
773
</constant>
774
<constant name="FIND_MODE_EXACT" value="2" enum="FindMode">
775
Finds only the key with matching the time.
776
</constant>
777
</constants>
778
</class>
779
780