mirror of
https://github.com/remvze/moodist.git
synced 2025-09-29 15:30:49 -04:00
fix: remove fading
This commit is contained in:
parent
5467bbbc24
commit
d96461d1ea
@ -43,9 +43,9 @@ export function Sound({
|
||||
|
||||
useEffect(() => {
|
||||
if (isSelected && isPlaying && functional) {
|
||||
sound?.fadeIn();
|
||||
sound?.play();
|
||||
} else {
|
||||
sound?.fadeOut();
|
||||
sound?.pause();
|
||||
}
|
||||
}, [isSelected, sound, isPlaying, functional]);
|
||||
|
||||
|
@ -62,28 +62,9 @@ export function useSound(
|
||||
if (sound) sound.pause();
|
||||
}, [sound]);
|
||||
|
||||
const fadeIn = useCallback(() => {
|
||||
if (sound) {
|
||||
if (!sound.playing()) {
|
||||
play();
|
||||
sound.fade(0, options.volume || 0.5, 1000);
|
||||
}
|
||||
}
|
||||
}, [play, sound, options.volume]);
|
||||
|
||||
const fadeOut = useCallback(() => {
|
||||
if (sound) {
|
||||
sound.fade(options.volume || 0.5, 0, 1000);
|
||||
|
||||
setTimeout(() => {
|
||||
sound.pause();
|
||||
}, 1200);
|
||||
}
|
||||
}, [sound, options.volume]);
|
||||
|
||||
const control = useMemo(
|
||||
() => ({ fadeIn, fadeOut, isLoading, pause, play, stop }),
|
||||
[play, stop, pause, isLoading, fadeIn, fadeOut],
|
||||
() => ({ isLoading, pause, play, stop }),
|
||||
[play, stop, pause, isLoading],
|
||||
);
|
||||
|
||||
return control;
|
||||
|
Loading…
x
Reference in New Issue
Block a user