-
-
Save parzibyte/55e8fd4da60b0f0c845b54504dcf438d 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
class Utils { | |
static getRandomNumberInRange = (min, max) => { | |
return Math.floor(Math.random() * (max - min + 1)) + min; | |
} | |
static getRandomColor() { | |
return Game.COLORS[Utils.getRandomNumberInRange(0, Game.COLORS.length - 1)]; | |
} | |
static loadSound(src, loop) { | |
const sound = document.createElement("audio"); | |
sound.src = src; | |
sound.setAttribute("preload", "auto"); | |
sound.setAttribute("controls", "none"); | |
sound.loop = loop || false; | |
sound.style.display = "none"; | |
document.body.appendChild(sound); | |
return sound; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment