Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/index.html4
-rw-r--r--public/style.css5
-rw-r--r--src/index.js6
3 files changed, 15 insertions, 0 deletions
diff --git a/public/index.html b/public/index.html
index 68acea4..a60db29 100644
--- a/public/index.html
+++ b/public/index.html
@@ -143,6 +143,10 @@
</fieldset>
</div>
+ <div class="map-placeholder">
+ Loading...
+ </div>
+
<object type="image/svg+xml" data="map.svg"></object>
<div id="status">
diff --git a/public/style.css b/public/style.css
index 00d9d74..a8fa57a 100644
--- a/public/style.css
+++ b/public/style.css
@@ -16,6 +16,11 @@ svg, object {
height: 100%;
}
+object {
+ opacity: 0;
+ transition: opacity 0.25s;
+}
+
svg image {
image-rendering: pixelated;
}
diff --git a/src/index.js b/src/index.js
index cb746f4..617e953 100644
--- a/src/index.js
+++ b/src/index.js
@@ -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', () => {
const svg = document.querySelector('object').contentDocument.querySelector('svg'),
game = new Game(svg);