2018-09-21 03:37:07 +01:00
|
|
|
extends Control
|
|
|
|
|
|
|
|
onready var background = get_node("background")
|
|
|
|
onready var tween = get_node("tween")
|
|
|
|
|
2018-09-21 03:54:04 +01:00
|
|
|
signal on_transition_time()
|
2018-09-21 03:37:07 +01:00
|
|
|
signal on_transition_completed()
|
|
|
|
|
|
|
|
const TRANSITION_TIME = 1.0
|
|
|
|
|
|
|
|
func _ready():
|
|
|
|
pass
|
|
|
|
|
|
|
|
func start_transition():
|
|
|
|
|
|
|
|
tween.interpolate_property(
|
|
|
|
background, "color:a", background.color.a, 1.0,
|
|
|
|
TRANSITION_TIME, Tween.TRANS_QUAD,
|
|
|
|
Tween.EASE_IN_OUT
|
|
|
|
)
|
|
|
|
|
|
|
|
tween.start()
|
|
|
|
yield(tween, "tween_completed")
|
2018-09-21 03:54:04 +01:00
|
|
|
emit_signal("on_transition_time")
|
2018-09-21 03:37:07 +01:00
|
|
|
|
|
|
|
tween.interpolate_property(
|
|
|
|
background, "color:a", background.color.a, 0.0,
|
|
|
|
TRANSITION_TIME, Tween.TRANS_QUAD,
|
|
|
|
Tween.EASE_IN_OUT
|
|
|
|
)
|
|
|
|
tween.start()
|
2018-09-21 03:54:04 +01:00
|
|
|
yield(tween, "tween_completed")
|
|
|
|
emit_signal("on_transition_completed")
|
2018-09-21 03:37:07 +01:00
|
|
|
|