Last active
October 16, 2018 20:14
-
-
Save nathanwentworth/77663be121eb815ec132c97853c880df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>test</title> | |
<meta charset="utf-8"> | |
<style type="text/css"> | |
.image-container { | |
position: relative; | |
background-image: url('https://f4.bcbits.com/img/a2628187388_16.jpg'); | |
height: 400px; | |
width: 400px; | |
background-size: cover; | |
} | |
.progress-bar-container { | |
position: absolute; | |
width: 200px; | |
height: 40px; | |
left: 50%; | |
bottom: 16px; | |
transform: translateX(-50%); | |
} | |
.progress-bar-body { | |
background: #f55; | |
width: 100%; | |
height: 100%; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="image-container"> | |
<div class="progress-bar-container"> | |
<div class="progress-bar-body"></div> | |
</div> | |
</div> | |
</body> | |
<script type="text/javascript"> | |
function UnityProgress(gameInstance, progress) { | |
if (!gameInstance.Module) | |
return; | |
if (!gameInstance.logo) { | |
gameInstance.logo = document.createElement("div"); | |
gameInstance.logo.className = "logo " + gameInstance.Module.splashScreenStyle; | |
gameInstance.container.appendChild(gameInstance.logo); | |
} | |
if (!gameInstance.progress) { | |
gameInstance.progress = document.querySelector('.image-container .progress-bar-container'); | |
gameInstance.progress.classList.add(gameInstance.Module.splashScreenStyle) | |
gameInstance.progress.full = document.querySelector('.image-container .progress-bar-body'); | |
} | |
gameInstance.progress.full.style.width = (100 * progress) + "%"; | |
if (progress === 1) | |
gameInstance.logo.style.display = gameInstance.progress.style.display = "none"; | |
} | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment