Godot - Implement blinking animation with Tween
GDScript code example to implement blinking animation with Tween.
One way to implement blinking process with Tween is to enable repeat processing with set_loops()
and reciprocate transparency between "0" and "1" with tween_property()
.
Adjust to your preferred blinking timing with the 3rd argument of tween_property()
(animation time) and set_delay()
.
var tween = create_tween().set_loops()
tween.tween_property(self, "modulate", Color( 1, 1, 1, 0), 0.1)
tween.tween_property(self, "modulate", Color( 1, 1, 1, 1), 0.1).set_delay(0.1)