Finally I figured it out:
I need two Timers: TimerOn and TimerOff. They are configured to run one shot and both have signals to start each other:
# TimerOn
extends Timer
func _ready():
pass
func _on_TimerOff_timeout():
start()
# TimerOff
extends Timer
func _ready():
pass
func _on_TimerOn_timeout():
start()
Then each node that performs the actions is connected to the timeout() signal in this way:
extends Node2D
var active
func _ready():
activate(true)
pass
func activate(a):
active=a
get_child(0).show()
get_child(1).hide()
get_child(2).hide()
func _on_TimerOn_timeout():
if not active: return
get_child(0).show()
get_child(1).hide()
get_child(2).hide()
func _on_TimerOff_timeout():
if not active: return
get_child(0).hide()
get_child(1).show()
get_child(2).show()
With this pair of Timers it is always sure that the on and off triggers are synchronized.