[SOLVED]Fade out sound

I’d like to fade out the background music in my level when the player dies, before the game over screen loads.

Having looked at the examples and the docs, I couldn’t find a solution I fully understood.
Has anyone done this before?

I found this plugin, but I’m not sure I’m importing it correctly, because I get an error at the import statement…
https://rexrainbow.github.io/phaser3-rex-notes/docs/site/fadevolume/

You can tween the “volume” property of your sound object:

    var mySound = myScene.sound.add(soundKey);
    myScene.tweens.add({
        targets:  mySound,
        volume:   0,
        duration: 500
    });
3 Likes