I love uploading code that is actually not ready..
This commit is contained in:
14
effects.js
vendored
14
effects.js
vendored
@@ -10,8 +10,9 @@ function getRandomInt(max)
|
||||
async function GameDetails( servername, serverurl, mapname, maxplayers, steamid, gamemode, volume, language )
|
||||
{
|
||||
const config = await (await fetch("/config.json")).json();
|
||||
const audioplayer = document.getElementById("audioplayer");
|
||||
|
||||
if (config.map[mapname].images.length > 0)
|
||||
{
|
||||
let imgArray = [];
|
||||
|
||||
for (let i = 0; i < config.map[mapname].images.length; i++)
|
||||
@@ -30,19 +31,16 @@ async function GameDetails( servername, serverurl, mapname, maxplayers, steamid,
|
||||
document.getElementsByClassName("mapName")[0].innerHTML = "<h1>" + mapname.toUpperCase() + "</h1>";
|
||||
document.getElementsByClassName("gamemodeName")[0].textContent = gamemode;
|
||||
|
||||
|
||||
let autoCycleImages = setInterval(() => {
|
||||
|
||||
if (bgObj[prevImage].classList.contains("blendInAnimation"))
|
||||
{
|
||||
bgObj[prevImage].classList.remove("blendInAnimation");
|
||||
}
|
||||
|
||||
bgObj[prevImage].classList.add("blendOutAnimation");
|
||||
|
||||
if (bgObj[currentImage].classList.contains("blendOutAnimation"))
|
||||
{
|
||||
bgObj[currentImage].classList.remove("blendOutAnimation");
|
||||
}
|
||||
|
||||
bgObj[currentImage].classList.add("blendInAnimation");
|
||||
|
||||
@@ -52,11 +50,17 @@ async function GameDetails( servername, serverurl, mapname, maxplayers, steamid,
|
||||
if (currentImage >= imgArray.length)
|
||||
currentImage = 0;
|
||||
}, 5000)
|
||||
}
|
||||
|
||||
if (config.map[mapname].music.length > 0)
|
||||
{
|
||||
const audioplayer = document.getElementById("audioplayer");
|
||||
|
||||
audioplayer.volume = 0;
|
||||
let autoAdjustVolume = setInterval(() => { if (audioplayer.volume > 0.9) { clearInterval(autoAdjustVolume); return; } audioplayer.volume += 0.01}, 40);
|
||||
audioplayer.src = config.map[mapname].music[getRandomInt(config.map[mapname].music.length)];
|
||||
audioplayer.play();
|
||||
}
|
||||
|
||||
document.getElementsByClassName("loadingEntry")[0].classList.add("blendInAnimation");
|
||||
}
|
||||
Reference in New Issue
Block a user