Created
April 21, 2011 08:47
-
-
Save madrobby/934008 to your computer and use it in GitHub Desktop.
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
// tweet-sized, and does (approximately) the same thing | |
var t=document.all,l=t.length,w='-webkit-trans';while(l--)t[l].style.cssText+=w+'ition:all,20s;'+w+'form:rotate('+Math.random()+'rad)' |
109: like @joside's but with *
instead of div
s='-webkit-trans';document.styleSheets[1].addRule('*',s+'ition:20s;'+s+'form:rotate('+Math.random()+'rad)')
Edit:
Not sure where the 20s came from but 9s looks just as good:
s='-webkit-trans';document.styleSheets[1].addRule('*',s+'ition:9s;'+s+'form:rotate('+Math.random()+'rad)')
I think @joside has won this game.
@marcheiligers : what if there is actually not any document.styleSheets ?
Should be able to get it to work in Opera with '-o-trans'
, which would shave 5 chars but I can't get it to work :-(. Means you loose 1% of browser market share though.
[].map.call(document.all,function(e,s){s='-webkit-trans';e.style.cssText+=s+'ition:20s;'+s+'form:rotate('+Math.random()+'rad)'})
Array.prototype.slice.call(document.all).forEach(function(e,s){s='-webkit-trans';e.style.cssText+=s+'ition:20s;'+s+'form:rotate('+Math.random()+'rad)'})
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
w="-webkit-trans";i=0;while(e=document.querySelectorAll("div")[i++])e.style.cssText+=w+"ition:20s;"+w+"form:rotate("+i/10+"rad)"