From 4c066b821c31a3b96dc3846d6522239078726e20 Mon Sep 17 00:00:00 2001 From: Ategon Date: Wed, 28 Aug 2024 21:07:57 -0400 Subject: [PATCH] Fix fading system --- src/main.gd | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main.gd b/src/main.gd index 928b95f..13463ff 100644 --- a/src/main.gd +++ b/src/main.gd @@ -37,21 +37,19 @@ func _play(): print("NO SONG COULD BE FOUND") return - if volume_tween: volume_tween.kill() - volume_tween = create_tween() - volume_tween.tween_property(audio_stream_player, "volume_db", -30, 3) - volume_tween.tween_callback(func(): - audio_stream_player.stream = load(song.track) - ) - volume_tween.tween_property(audio_stream_player, "volume_db", 0, 3) - - + audio_stream_player.volume_db = -30 + audio_stream_player.stream = load(song.track) audio_stream_player.play() music_display.show_song(song) current_track = song + + volume_tween = create_tween() + volume_tween.tween_property(audio_stream_player, "volume_db", 0, 3) + volume_tween.tween_interval(audio_stream_player.stream.get_length() - 3) + volume_tween.tween_property(audio_stream_player, "volume_db", -30, 3) func _stop():