Created
October 7, 2014 13:09
-
-
Save lebbe/3f0bffeeef1997ebebe8 to your computer and use it in GitHub Desktop.
Transform any web-page into a psychedelic experience
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
| window.setInterval(function() { | |
| var levelColors = [], m = Math; | |
| function getLevelColor(level) { | |
| if(levelColors[level] === undefined) { | |
| levelColors[level] = (m.PI * m.random()).toString(16).slice(-2); | |
| } | |
| return levelColors[level]; | |
| } | |
| (function rec(node, level) { | |
| if(node.style) | |
| node.style.boxShadow = window.getComputedStyle(node).width + ' 0 #' + getLevelColor(level) + ' inset'; | |
| [].forEach.call(node.childNodes, function(node) { | |
| rec(node, level + 1) | |
| }); | |
| })(document, 0); | |
| }, 1000); |
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
| window.setInterval(function(){function e(c){void 0===a[c]&&(a[c]=(d.PI*d.random()).toString(16).slice(-6));return a[c]}var a=[],d=Math;(function f(b,a){b.style&&(b.style.boxShadow=window.getComputedStyle(b).width+" 0 #"+e(a)+" inset");[].forEach.call(b.childNodes,function(b){f(b,a+1)})})(document,0)},1E3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment