Fix fading system
This commit is contained in:
parent
261510de9c
commit
4c066b821c
1 changed files with 7 additions and 9 deletions
14
src/main.gd
14
src/main.gd
|
@ -37,22 +37,20 @@ func _play():
|
||||||
print("NO SONG COULD BE FOUND")
|
print("NO SONG COULD BE FOUND")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
if volume_tween:
|
if volume_tween:
|
||||||
volume_tween.kill()
|
volume_tween.kill()
|
||||||
|
|
||||||
volume_tween = create_tween()
|
audio_stream_player.volume_db = -30
|
||||||
volume_tween.tween_property(audio_stream_player, "volume_db", -30, 3)
|
|
||||||
volume_tween.tween_callback(func():
|
|
||||||
audio_stream_player.stream = load(song.track)
|
audio_stream_player.stream = load(song.track)
|
||||||
)
|
|
||||||
volume_tween.tween_property(audio_stream_player, "volume_db", 0, 3)
|
|
||||||
|
|
||||||
|
|
||||||
audio_stream_player.play()
|
audio_stream_player.play()
|
||||||
music_display.show_song(song)
|
music_display.show_song(song)
|
||||||
current_track = 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():
|
func _stop():
|
||||||
audio_stream_player.stop()
|
audio_stream_player.stop()
|
||||||
|
|
Loading…
Reference in a new issue