tween_completed is a signal that is emitted by the Tween node. This signal is emitted when an individual interpolation of the tween finishes. Because a Tween can animate an arbitrary number of objects and properties, they can each finish at a different time.
Here's an example that may illustrate this. Let's assume that in our scene we have an Area2D with an attached Sprite, along with a Tween. First, we set up two interpolations:
$Tween.interpolate_property(self, "position", position,
position+Vector2(100, 0), 1.0,
$Tween.interpolate_property($Sprite, "modulate:a", 1.0,
0.0, 5.0, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
The first interpolation will move the root Area2D's position by 100 pixels over 1 second. The second will fade the Sprite's
modulate:a (alpha channel) to 0 over 5 seconds.
If we then connect the
tween_completed signal, and add this:
func _on_Tween_tween_completed(object, key):
We'll get two things printed:
The function gets called twice - once for the end of each of the interpolations. If you wanted some code to run at the time one of them ended, you could use those parameters to detect that.