godot-vn/transition.gd

31 lines
602 B
GDScript3
Raw Normal View History

2018-09-21 03:37:07 +01:00
extends Control
onready var background = get_node("background")
onready var tween = get_node("tween")
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")
emit_signal("on_transition_completed")
tween.interpolate_property(
background, "color:a", background.color.a, 0.0,
TRANSITION_TIME, Tween.TRANS_QUAD,
Tween.EASE_IN_OUT
)
tween.start()