Skip to content

Instantly share code, notes, and snippets.

@kyleburton
Created August 17, 2011 02:31
Show Gist options
  • Save kyleburton/1150687 to your computer and use it in GitHub Desktop.
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.
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();
@adamvduke
Copy link

Would be interesting to combine this in ~/.js/default.js and https://github.com/defunkt/dotjs running to have it included automatically.

@kyleburton
Copy link
Author

That would be pretty crazy indeed %)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment