Last active
October 4, 2017 19:43
-
-
Save easierbycode/859140f2c9e2a57bd52793c0928c5903 to your computer and use it in GitHub Desktop.
utils for transitioning between game and DOM elements
This file contains hidden or 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
function fadeIn(id,speed) { | |
var element = document.getElementById(id); | |
var op = 0.1; // initial opacity | |
element.style.visibility = 'visible'; | |
element.style.opacity = op; | |
var timer = setInterval(function () { | |
if (op >= 1){ | |
clearInterval(timer); | |
} | |
element.style.opacity = op; | |
element.style.filter = 'alpha(opacity=' + op * 100 + ")"; | |
op = op * 1.5; | |
}, speed); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment