Godot - Get Tween animation playback time
GDScript code example to get Tween animation playback time.
get_total_elapsed_time()
can get Tween animation playback time.
The get_total_elapsed_time()
return value is in seconds, and does not include pause()
suspend time.
It is also affected by speed changes from set_speed_scale()
.
For example, if set to 10x speed with set_speed_scale()
, the get_total_elapsed_time()
return value will be 10 times the actual elapsed time.
var tween = create_tween().set_loops()
func _ready():
tween.tween_property(self, "modulate", Color( 1, 1, 1, 0), 0.5)
tween.tween_property(self, "modulate", Color( 1, 1, 1, 1), 0.5).set_delay(0.5)
tween.play()
func _physics_process(_delta):
var tween_playtime = tween.get_total_elapsed_time()
print(tween_playtime)