New effects and timer

This commit is contained in:
Marcel
2017-12-18 21:02:05 +01:00
parent 41f702a18b
commit cc5f9cf1bd
4 changed files with 44 additions and 2 deletions

24
menu.js
View File

@@ -87,6 +87,30 @@ function fadeBlurOut() {
}
}
function scoreUpdateAni() {
const scoreEl = document.getElementById("score");
const nativeTransform = "translate(-50%, -50%)";
const scale = 1.5;
const finalScale = 1;
let currentScale = 1;
let upscaling = true;
const id = setInterval(frame, 5);
function frame() {
if(currentScale <= scale && upscaling) {
currentScale += 0.02;
scoreEl.style.transform = nativeTransform + " scale(" + currentScale + ")";
} else if (currentScale >= finalScale) {
upscaling = false;
currentScale -= 0.02;
scoreEl.style.transform = nativeTransform + " scale(" + currentScale + ")";
} else {
clearInterval(id);
}
}
}
function showMenu() {
isPaused = true;
document.getElementById("game-title").style.opacity = "1";