This commit is contained in:
Timothy J. Baek
2024-06-12 00:05:20 -07:00
parent db6ca856de
commit cde9672a09
4 changed files with 116 additions and 4 deletions
+28 -2
View File
@@ -1,5 +1,8 @@
<script>
import { io } from 'socket.io-client';
import { spring } from 'svelte/motion';
let loadingProgress = spring(0);
import { onMount, tick, setContext } from 'svelte';
import {
@@ -116,8 +119,31 @@
await tick();
document.getElementById('splash-screen')?.remove();
loaded = true;
if (
document.documentElement.classList.contains('her') &&
document.getElementById('progress-bar')
) {
loadingProgress.subscribe((value) => {
document.getElementById('progress-bar').style.width = `${value * 0.24}rem`;
});
await loadingProgress.set(100);
document.getElementById('splash-screen')?.remove();
const audio = new Audio(`/audio/greeting.mp3`);
const playAudio = () => {
audio.play();
document.removeEventListener('click', playAudio);
};
document.addEventListener('click', playAudio);
loaded = true;
} else {
document.getElementById('splash-screen')?.remove();
loaded = true;
}
return () => {
window.removeEventListener('resize', onResize);