Animation Track types

This page gives an overview of the track types available for Godot’s animation player node on top of the default property tracks.

See also

We assume you already read Introduction to the animation features, which covers the basics, including property tracks.

../../_images/track_types.webp

Property Track

The most basic track type. See Introduction to the animation features.

Position 3D / Rotation 3D / Scale 3D Track

These 3D transform tracks control the location, rotation, and scale of a 3D object. They make it easier to animate a 3D object’s transform compared to using regular property tracks.

It is designed for animations imported from external 3D models and can reduce resource capacity through compression.

Blend Shape Track

A blend shape track is optimized for animating blend shape in MeshInstance3D.

It is designed for animations imported from external 3D models and can reduce resource capacity through compression.

Call Method Track

A call method track allow you to call a function at a precise time from within an animation. For example, you can call queue_free() to delete a node at the end of a death animation.

Note

The events placed on the call method track are not executed when the animation is previewed in the editor for safety.

To create such a track in the editor, click “Add Track -> Call Method Track.” Then, a window opens and lets you select the node to associate with the track. To call one of the node’s methods, right-click the timeline and select “Insert Key”. A window opens with a list of available methods. Double-click one to finish creating the keyframe.

../../_images/node_methods.webp

To change the method call or its arguments, click on the key and head to the inspector dock. There, you can change the method to call. If you expand the “Args” section, you will see a list of arguments you can edit.

../../_images/node_method_args.webp

To create such a track through code, pass a dictionary that contains the target method’s name and parameters as the Variant for key in Animation.track_insert_key(). The keys and their expected values are as follows:

Key

Value

“method”

The name of the method as a String

“args”

The arguments to pass to the function as an Array

GDScriptC#

  1. # Create a call method track.
  2. func create_method_animation_track():
  3. # Get or create the animation the target method will be called from.
  4. var animation = $AnimationPlayer.get_animation("idle")
  5. # Get or create the target method's animation track.
  6. var track_index = animation.add_track(Animation.TYPE_METHOD)
  7. # Make the arguments for the target method jump().
  8. var jump_velocity = -400.0
  9. var multiplier = randf_range(.8, 1.2)
  10. # Get or create a dictionary with the target method's name and arguments.
  11. var method_dictionary = {
  12. "method": "jump",
  13. "args": [jump_velocity, multiplier],
  14. }
  15. # Set scene-tree path to node with target method.
  16. animation.track_set_path(track_index, ".")
  17. # Add the dictionary as the animation method track's key.
  18. animation.track_insert_key(track_index, 0.6, method_dictionary, 0)
  19. # The target method that will be called from the animation.
  20. func jump(jump_velocity, multiplier):
  21. velocity.y = jump_velocity * multiplier
  1. // Create a call method track.
  2. public void CreateAnimationTrack()
  3. {
  4. // Get reference to the AnimationPlayer.
  5. var animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
  6. // Get or create the animation the target method will be called from.
  7. var animation = animationPlayer.GetAnimation("idle");
  8. // Get or create the target method's animation track.
  9. var trackIndex = animation.AddTrack(Animation.TrackType.Method);
  10. // Make the arguments for the target method Jump().
  11. var jumpVelocity = -400.0;
  12. var multiplier = GD.RandRange(.8, 1.2);
  13. // Get or create a dictionary with the target method's name and arguments.
  14. var methodDictionary = new Godot.Collections.Dictionary
  15. {
  16. { "method", MethodName.Jump },
  17. { "args", new Godot.Collections.Array { jumpVelocity, multiplier } }
  18. };
  19. // Set scene-tree path to node with target method.
  20. animation.TrackSetPath(trackIndex, ".");
  21. // Add the dictionary as the animation method track's key.
  22. animation.TrackInsertKey(trackIndex, 0.6, methodDictionary, 0);
  23. }
  24. // The target method that will be called from the animation.
  25. private void Jump(float jumpVelocity, float multiplier)
  26. {
  27. Velocity = new Vector2(Velocity.X, jumpVelocity * multiplier);
  28. }

Bezier Curve Track

A bezier curve track is similar to a property track, except it allows you to animate a property’s value using a bezier curve.

Note

Bezier curve track and property track cannot be blended in AnimationPlayer and AnimationTree.

To create one, click “Add Track -> Bezier Curve Track”. As with property tracks, you need to select a node and a property to animate. To open the bezier curve editor, click the curve icon to the right of the animation track.

../../_images/bezier_curve_icon.webp

In the editor, keys are represented by filled diamonds and the outlined diamonds connected to them by a line control curve’s shape.

Tip

For better precision while manually working with curves, you might want to alter the zoom levels of the editor. The slider on the bottom right of the editor can be used to zoom in and out on the time axis, you can also do that with Ctrl + Shift + Mouse wheel. Using Ctrl + Alt + Mouse wheel will zoom in and out on the Y axis

../../_images/bezier_curves.webp

In the right click panel of the editor, you can select the handle mode:

  • Free: Allows you to orient a manipulator in any direction without affecting the other’s position.

  • Linear: Does not allow rotation of the manipulator and draws a linear graph.

  • Balanced: Makes it so manipulators rotate together, but the distance between the key and a manipulator is not mirrored.

  • Mirrored: Makes the position of one manipulator perfectly mirror the other, including their distance to the key.

../../_images/manipulator_modes.webp

Audio Playback Track

If you want to create an animation with audio, you need to create an audio playback track. To create one, your scene must have either an AudioStreamPlayer, AudioStreamPlayer2D, or AudioStreamPlayer3D node. When creating the track, you must select one of those nodes.

To play a sound in your animation, drag and drop an audio file from the file system dock onto the animation track. You should see the waveform of your audio file in the track.

../../_images/audio_track.webp

To remove a sound from the animation, you can right-click it and select “Delete Key(s)” or click on it and press the Del key.

The blend mode allows you to choose whether or not to adjust the audio volume when blending in the AnimationTree.

../../_images/blend_mode.webp

Animation Playback Track

Animation playback tracks allow you to sequence the animations of other animation player nodes in a scene. For example, you can use it to animate several characters in a cut-scene.

To create an animation playback track, select “New Track -> Animation Playback Track.”

Then, select the animation player you want to associate with the track.

To add an animation to the track, right-click on it and insert a key. Select the key you just created to select an animation in the inspector dock.

../../_images/animation_player_animation.webp

If an animation is already playing and you want to stop it early, you can create a key and have it set to [STOP] in the inspector.

Note

If you instanced a scene that contains an animation player into your scene, you need to enable “Editable Children” in the scene tree to access its animation player. Also, an animation player cannot reference itself.


User-contributed notes

Please read the User-contributed notes policy before submitting a comment.

Previous Next