-
-
Save wrayal/994257 to your computer and use it in GitHub Desktop.
140 byte wraytracer
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
function( | |
s //size of sphere, 55 works...not much else does. Maybe 54? ^_^ | |
,i //placeholder for loop over rows | |
,j //placeholder for loop in rows | |
,k //(uninitialised *halo*) output string | |
){ | |
for(i=-9;i++<(j=18)/2;k+="<br>") //outer loop including aspect fudge | |
for(;j-->-18;) //inner loop | |
k+='<font color=#00'+(j*j/4+i*i<s?(0|(i+j+80)*.1):'0')+'>#</font>'; | |
//outputting by font-colored hashes with 'realistic' linear shading, fake hexadecimal and aspect 'correction' | |
return k //and return it...because 'document.write' is unfriendly to 140byte scripts ;) | |
} |
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
function(s,i,j,k){for(i=-9;i++<(j=18)/2;k+="<br>")for(;j-->-18;)k+='<font color=#00'+(j*j/4+i*i<s?(0|(i+j+80)*.1):'0')+'>#</font>';return k} |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | |
0. You just DO WHAT THE FUCK YOU WANT TO. |
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
{ | |
"name": "140bRt", | |
"description": "trace out a sphere, now with realistic shading =D.", | |
"keywords": [ | |
"140bytes", | |
"raytrace" | |
] | |
} |
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
<!DOCTYPE html> | |
<title>140b raytracing</title> | |
<pre> | |
Raytraced output: <br /><b id="ret"></b> | |
</pre> | |
<script> | |
function b(text) | |
{ | |
document.getElementById( "ret" ).innerHTML=text | |
} | |
var myFunction=function(s,i,j,k){for(i=-9;i++<(j=18)/2;k+="<br>")for(;j-->-18;)k+='<font color=#00'+(j*j/4+i*i<s?(0|(i+j+80)*.1):'0')+'>#</font>';return k} | |
b(myFunction(55,i=0,j=0,"")) | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tested to play well with Chrome, apparently not with IE9.