splash screen for web

This commit is contained in:
Naser Hassan
2022-07-27 14:46:14 +03:00
parent 40c1f8083e
commit c8c19cc469
11 changed files with 76 additions and 0 deletions

View File

@@ -31,8 +31,16 @@
<title>doddle</title>
<link rel="manifest" href="manifest.json">
<script src="splash/splash.js"></script>
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport"/>
<link rel="stylesheet" type="text/css" href="splash/style.css">
</head>
<body>
<picture id="splash">
<source srcset="splash/img/light-1x.png 1x, splash/img/light-2x.png 2x, splash/img/light-3x.png 3x, splash/img/light-4x.png 4x" media="(prefers-color-scheme: light)">
<source srcset="splash/img/dark-1x.png 1x, splash/img/dark-2x.png 2x, splash/img/dark-3x.png 3x, splash/img/dark-4x.png 4x" media="(prefers-color-scheme: dark)">
<img class="center" aria-hidden="true" src="splash/img/light-1x.png" alt=""/>
</picture>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->

BIN
web/splash/img/dark-1x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
web/splash/img/dark-2x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
web/splash/img/dark-3x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

BIN
web/splash/img/dark-4x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

BIN
web/splash/img/light-1x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

BIN
web/splash/img/light-2x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 95 KiB

BIN
web/splash/img/light-3x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 187 KiB

BIN
web/splash/img/light-4x.png Normal file
View File

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 KiB

5
web/splash/splash.js Normal file
View File

@@ -0,0 +1,5 @@
function removeSplashFromWeb() {
document.getElementById("splash")?.remove();
document.getElementById("splash-branding")?.remove();
document.body.style.background = "transparent";
}

63
web/splash/style.css Normal file
View File

@@ -0,0 +1,63 @@
body {
margin:0;
height:100%;
background: #000000;
background-size: 100% 100%;
}
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.contain {
display:block;
width:100%; height:100%;
object-fit: contain;
}
.stretch {
display:block;
width:100%; height:100%;
}
.cover {
display:block;
width:100%; height:100%;
object-fit: cover;
}
.bottom {
position: absolute;
bottom: 0;
left: 50%;
-ms-transform: translate(-50%, 0);
transform: translate(-50%, 0);
}
.bottomLeft {
position: absolute;
bottom: 0;
left: 0;
}
.bottomRight {
position: absolute;
bottom: 0;
right: 0;
}
@media (prefers-color-scheme: dark) {
body {
margin:0;
height:100%;
background: #000000;
background-size: 100% 100%;
}
}