Skip to content

Instantly share code, notes, and snippets.

@HiZhaoxiaoyang
Created August 6, 2014 09:30
Show Gist options
  • Save HiZhaoxiaoyang/4fb70954c5f1eada3813 to your computer and use it in GitHub Desktop.
Save HiZhaoxiaoyang/4fb70954c5f1eada3813 to your computer and use it in GitHub Desktop.
A Pen by survivol.
<section></section>
(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)
}()
})();
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