Created
July 13, 2018 00:43
-
-
Save rodolfoghi/388e4075768f54d4370665c53315ab6f 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
// Constante referente ao palco | |
const $palco = document.getElementById('palco'); | |
// https://developer.mozilla.org/pt-BR/docs/Web/JavaScript/Reference/Global_Objects/Math/random | |
function getRandomInt(min, max) { | |
min = Math.ceil(min); | |
max = Math.floor(max); | |
return Math.floor(Math.random() * (max - min)) + min; | |
} | |
// Esconde a imagem fantasma1. | |
function esconda() { | |
$fantasma1.style.top = getRandomInt(0, $palco.clientHeight - $fantasma1.clientHeight) + "px"; | |
$fantasma1.style.left = getRandomInt(0, $palco.clientWidth - $fantasma1.clientWidth) + "px"; | |
$fantasma1.style.display = "none"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment