Created
August 6, 2014 09:30
-
-
Save HiZhaoxiaoyang/4fb70954c5f1eada3813 to your computer and use it in GitHub Desktop.
A Pen by survivol.
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
<section></section> |
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() { | |
var sec = document.querySelectorAll('section')[0] | |
if (!window.requestAnimationFrame) { | |
window.requestAnimationFrame = (function() { | |
return window.webkitRequestAnimationFrame || | |
window.mozRequestAnimationFrame || | |
window.oRequestAnimationFrame || | |
window.msRequestAnimationFrame || | |
function( /* function FrameRequestCallback */ callback, /* DOMElement Element */ element) { | |
window.setTimeout(callback, 1000 / 60); | |
}; | |
})(); | |
} | |
~ | |
function animate() { | |
// console.test: | |
! function() { | |
return console.log(function() { | |
return function() { | |
var arr = [] | |
for (i = 0; i < 6; i++) { | |
arr.push(Math.floor(Math.random() * 16 % 16).toString(16)) | |
} | |
return arr.join('') | |
}() | |
}()) | |
}() | |
var color = (function() { | |
var arr = [] | |
for (i = 0; i < 6; i++) { | |
arr.push(Math.floor(Math.random() * 16 % 16).toString(16)) | |
} | |
return arr.join('') | |
})() | |
sec.style.backgroundColor = '#' + color | |
requestAnimationFrame(animate) | |
}() | |
})(); |
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
section { | |
position: absolute; | |
left: 0; | |
top:0; | |
right: 0; | |
bottom: 0; | |
background-color: #fff; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment