CodeBlanks Logo Icon CodeBlanks

Sync and queuing

Learn animation sync and queuing.

Animation synchronization

Synchronization makes multiple animations play at the same time and in harmony. The sync settings inside AnimationTree align clip timings. This way transitions look natural.

player.play("yurume", 0.3)

The second parameter sets the transition duration.

Queue and advance()

The queue() method adds the next animation to the queue. advance() fast forwards the animation and skips a certain duration. A queue makes animations play in order and without breaks.

player.queue("ziplama")

The queue mechanism is very useful for consecutive movements.

Practice Create an animation queue

In a script named KuyrukKurulumu, assign the $AnimationPlayer node to a variable named player in _ready. Add the animation to the queue with player.queue("ziplama") and print the text "Kuyrukta bekliyor" with print.

Starter code

Player.cs
extends Node

func _ready():
    var player = $AnimationPlayer
    # player uzerinden "ziplama" animasyonunu kuyruga ekle
    # "Kuyrukta bekliyor" metnini yazdir

Sample solution

Player.cs
extends Node

func _ready():
    var player = $AnimationPlayer
    player.queue("ziplama")
    print("Kuyrukta bekliyor")

Expected output

Kuyrukta bekliyor

Questions and answers

Review the lesson questions together with their answers. To test yourself, solve the lesson interactively.

1 What does the queue() method do?

  • It immediately stops the current animation
  • It adds the next animation to the queue Correct answer
  • It synchronizes animations
  • It clears the queue

Explanation: The queue() method adds the next animation to the queue; it starts automatically when the current animation ends.

2 Write the queue method name

Question
    player.____("ziplama")
Answer
    player.queue("ziplama")

Explanation: In AnimationPlayer, the method that adds the next animation to the queue is queue.

3 Sync and queue terms

Term Meaning
queue() Adding the next animation to the queue
advance() Fast forwarding the animation
Sync Aligning the timing of animations
Kuyruk The list of waiting animations

All lessons in Expert