var launchInterval = -1; var launchCounter = 1; var launchCountdownNumberElement = null; var launchCountdownProgressElement = null; function launchTick() { launchCountdownNumberElement.innerText = "" + Math.floor(6.0 - launchCounter * 0.06); launchCountdownProgressElement.style.width = "" + launchCounter + "%"; if(++launchCounter > 100) { clearInterval(launchInterval); setTimeout(() => { document.getElementById("launch_countdown_screen").remove(); main(); }, 50); } } window.addEventListener("load", () => { launchCountdownNumberElement = document.getElementById("launchCountdownNumber"); launchCountdownProgressElement = document.getElementById("launchCountdownProgress"); launchInterval = setInterval(launchTick, 50); });