Created
August 17, 2011 02:31
-
-
Save kyleburton/1150687 to your computer and use it in GitHub Desktop.
On any website, open the js-console and paste this... => wooo.stop() will halt the effect.
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
wooo = function () { | |
var self = {}; | |
self.interval = 1000; | |
self.iLikeIt = true; | |
self.init = function () { | |
var script = document.createElement("script"); | |
script.setAttribute("src", "http://mbostock.github.com/d3/d3.js?1.29.1") | |
document.getElementsByTagName("head")[0].appendChild(script); | |
self.tid = setTimeout(self.wooo,self.interval); | |
}; | |
self.wooo = function () { | |
d3.selectAll("p") | |
.transition() | |
.duration(self.interval) | |
.style("color",function () { | |
return "hsl(" + (Math.random()*360) + ",100%,50%)"; | |
}); | |
if (self.iLikeIt) { self.tid = setTimeout(self.wooo,self.interval); } | |
}; | |
self.stop = function () { | |
self.iLikeIt = false; | |
clearTimeout(self.tid); | |
d3.selectAll("p") | |
.transition() | |
.duration(self.interval) | |
.style("color","black"); | |
}; | |
return self; | |
}(); | |
wooo.init(); |
That would be pretty crazy indeed %)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would be interesting to combine this in ~/.js/default.js and https://github.com/defunkt/dotjs running to have it included automatically.