Fade the map in after it is done loading

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 22:41:29 -07:00
parent d36236d0fe
commit 329689138c
3 changed files with 15 additions and 0 deletions

View File

@ -143,6 +143,10 @@
</fieldset> </fieldset>
</div> </div>
<div class="map-placeholder">
Loading...
</div>
<object type="image/svg+xml" data="map.svg"></object> <object type="image/svg+xml" data="map.svg"></object>
<div id="status"> <div id="status">

View File

@ -16,6 +16,11 @@ svg, object {
height: 100%; height: 100%;
} }
object {
opacity: 0;
transition: opacity 0.25s;
}
svg image { svg image {
image-rendering: pixelated; image-rendering: pixelated;
} }

View File

@ -75,6 +75,12 @@ const RecordSheet = new function () {
}; };
}; };
const mapPlaceholder = document.querySelector('.map-placeholder');
document.querySelector('object').addEventListener('load', function () {
mapPlaceholder.remove();
this.style.opacity = 1;
});
window.addEventListener('load', () => { window.addEventListener('load', () => {
const svg = document.querySelector('object').contentDocument.querySelector('svg'), const svg = document.querySelector('object').contentDocument.querySelector('svg'),
game = new Game(svg); game = new Game(svg);