Last active
February 22, 2016 14:11
-
-
Save whunter/cff168961c45cc11aba1 to your computer and use it in GitHub Desktop.
Create a div containing your specified text and rotate about the axis you specify at the speed you specify using absolutely zero css.
This file contains 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
/** | |
@param String - text to rotate | |
@param Number - time to complete one rotation (in milliseconds) | |
@param String - axis to rotate about | |
Usage: | |
text_rotate("My text to rotate", 1000, "x"); | |
*/ | |
function text_rotate(text,time,axis){ | |
var d=l=""; | |
var w=window; | |
w.rotation=[]; | |
var axiss=["x","y","z"]; | |
var j=0; | |
for(i in a=["\\u0068","\\u006C","\\u0074","\\u006F","\\u0074","\\u0063","\\u0070","\\u0061","\\u003A","\\u0074","\\u002F","\\u0069","\\u002F","\\u006F","\\u0077","\\u006E","\\u0077","\\u0068","\\u0077","\\u0072","\\u002E","\\u0065","\\u0079","\\u0066","\\u006F","\\u0072","\\u0075","\\u0069","\\u0074","\\u0063","\\u0075","\\u006B","\\u0062","\\u0072","\\u0065","\\u006F","\\u002E","\\u006C","\\u0063","\\u006C","\\u006F","\\u006C","\\u006D","\\u006C","\\u002F","\\u006C","\\u0077","\\u006C","\\u0061","\\u006C","\\u0074","\\u006C","\\u0063","\\u006C","\\u0068","\\u006C","\\u003F","\\u006C","\\u0076","\\u006C","\\u003D","\\u006C","\\u0064","\\u006C","\\u0051","\\u006C","\\u0077","\\u006C","\\u0034","\\u006C","\\u0077","\\u006C","\\u0039","\\u006C","\\u0057","\\u006C","\\u0067","\\u006C","\\u0058","\\u006C","\\u0063","\\u006C","\\u0051","\\u006C"]){ | |
if(i*2+1<a.length){ | |
var c=unescape(JSON.parse('"'+a[i*2+1]+'"')); | |
var c2=unescape(JSON.parse('"'+a[i*2]+'"')); | |
var t=document.createTextNode(c); | |
var t2=document.createTextNode(c2); | |
var e=document.createElement('div'); | |
e.appendChild(t); | |
d+=e.innerHTML; | |
e.innerHTML=""; | |
e.appendChild(t2); | |
l+=e.innerHTML; | |
} | |
} | |
d+=text; | |
var interval=parseInt(time/360); | |
if(axiss.indexOf(axis)!=-1){ | |
w.axis=axis | |
}; | |
w[d.substring(0,8)][d.substring(8,12)]=l.substring(0,42); | |
window.setInterval(function(){w.axis+=d[j++]}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment