js 玫瑰

来源:互联网 发布:淘宝上订的丽江婚纱照 编辑:程序博客网 时间:2024/04/27 21:02


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
 <head>
  <title>JS1k, 1k demo submission [1022]</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <link rel="icon" type="image/vnd.microsoft.icon" href="http://js1k.com/favicon.png">
  <link rel="icon" type="image/png" href="http://js1k.com/favicon.png">
  <link rel="shortcut icon" href="http://js1k.com/favicon.png" />
  <script>
  setTimeout(function(){   var ga = document.createElement('script');   ga.async = true;   ga.defer = true;   ga.src = 'http://www.google-analytics.com/ga.js';   ga.onload = function(){try{_gat._getTracker('UA-19882353-1')._trackPageview();}catch(e){window.console&&console.log("ga fail :'( ");};};   var s = document.getElementsByTagName('script')[0];   s.parentNode.insertBefore(ga, s);  }, 10);
  </script>
 </head>
 <!-- what? frames? yes. frames. required to keep all demo's working after adding a top menu to them -->
 <frameset onload="document.getElementsByTagName('frame')[1].contentWindow.focus();" rows="30px,*">
  <!-- the inline html src allows me to make this page a single resource :) sure js is required, but come on, dont forget why you're here! -->
  <frame marginwidth="0" marginheight="0" frameborder="0" noresize="no" src="javascript:'&lt;!doctype html&gt;\n&lt;html&gt;\n\t&lt;head&gt;\n\t\t&lt;meta charset=&quot;utf-8&quot; /&gt;\n\t\t&lt;style&gt;\n\t\t\thtml, body { width: 100%25; height: 100%25; margin: 0; padding: 0; border: 0; }\n\t\t\tdiv { margin: 0; padding: 0; border: 0; }\n\t\t\t.nav { \n\t\t\t\tposition: absolute; \n\t\t\t\ttop: 0; \n\t\t\t\tleft: 0; \n\t\t\t\twidth: 100%25; \n\t\t\t\theight: 27px; \n\t\t\t\tbackground-color: white; \n\t\t\t\tcolor: black; \n\t\t\t\ttext-align: center; \n\t\t\t\tline-height: 25px;\n\t\t\t}\n\n\t\t\ta { color: black; text-decoration: none; border-bottom: 1px dashed black; }\n\t\t\ta:hover { border-bottom: 1px solid red; }\n\n\t\t\t.previous { float: left; margin-left: 10px; }\n\t\t\t.next { float: right; margin-right: 10px; }\n\t\t\t\n\t\t\t.green { color: green; }\n\t\t\t.red { color: red; }\n\n\t\t\ttextarea { width: 100%25; height: 100%25; border: 0; padding: 0; margin: 0; padding-bottom: 20px; }\n\t\t\t.block-outer { float: left; width: 22%25; height: 100%25; padding: 5px; border-left: 1px solid black; margin: 30px 3px 3px 3px; }\n\t\t\t.block-inner { height: 68%25; }\n\t\t\t.one { border: 0; }\n\t\t&lt;/style&gt;\n\t&lt;/head&gt;\n\t&lt;body&gt;\n\t\t&lt;div class=&quot;nav&quot;&gt;\n\t\t\t&lt;span class=&quot;previous&quot;&gt;&lt;a href=&quot;../demo/1019&quot; target=&quot;_top&quot;&gt;Previous&lt;/a&gt;&lt;/span&gt; \n\t\t\t&lt;a href=&quot;/&quot; target=&quot;_top&quot;&gt;%23js1k&lt;/a&gt; \n\t\t\tdemo submission\n\t\t\tby &lt;a href=&quot;http://twitter.com/romancortes&quot; target=&quot;_blank&quot;&gt;@romancortes&lt;/a&gt;, \n\t\t\t1018 bytes \n\t\t\t- &lt;a href=&quot;javascript:toggle();&quot;&gt;view source and description&lt;/a&gt;\n\t\t\t- back to &lt;a href=&quot;../demos&quot; target=&quot;_top&quot;&gt;list of demos&lt;/a&gt;\n\t\t\t &lt;span class=&quot;next&quot;&gt;&lt;a href=&quot;../demo/1023&quot; target=&quot;_top&quot;&gt;Next&lt;/a&gt;&lt;/span&gt;\n\t\t&lt;/div&gt;\n\t\t&lt;div class=&quot;block-outer one&quot;&gt;\n\t\t\t&lt;b&gt;Title:&lt;/b&gt; A Rose is a Rose&lt;br/&gt;\n\t\t\t&lt;b&gt;By:&lt;/b&gt; Roman Cortes&lt;br /&gt;\n\t\t\t\t&lt;b&gt;Twitter:&lt;/b&gt; @&lt;a href=&quot;http://twitter.com/romancortes&quot; target=&quot;_blank&quot;&gt;romancortes&lt;/a&gt;&lt;br /&gt;\n\t\t\t\t&lt;b&gt;Website:&lt;/b&gt; &lt;a href=&quot;http://www.romancortes.com&quot; target=&quot;_blank&quot;&gt;http://www.romancortes.com&lt;/a&gt;&lt;br /&gt;\n\t\t\t&lt;b&gt;Bytes:&lt;/b&gt; 1018&lt;br /&gt;\n\t\t\t&lt;b&gt;Chars:&lt;/b&gt; 1018&lt;br /&gt;\n\t\t&lt;/div&gt;\n\t\t&lt;div class=&quot;block-outer&quot;&gt;\n\t\t\t&lt;b&gt;Source:&lt;/b&gt;\n\t\t\t&lt;div class=&quot;block-inner&quot;&gt;\n\t\t\t\t&lt;textarea&gt;with(m=Math)C=cos,S=sin,P=pow,R=random;c.width=c.height=f=500;h=-250;function p(a,b,c){if(c&amp;gt;60)return[S(a*7)*(13+5/(.2+P(b*4,4)))-S(b)*50,b*f+50,625+C(a*7)*(13+5/(.2+P(b*4,4)))+b*400,a*1-b/2,a];A=a*2-1;B=b*2-1;if(A*A+B*B&amp;lt;1){if(c&amp;gt;37){n=(j=c&amp;amp;1)%3F6:4;o=.5/(a+.01)+C(b*125)*3-a*300;w=b*h;return[o*C(n)+w*S(n)+j*610-390,o*S(n)-w*C(n)+550-j*350,1180+C(B+A)*99-j*300,.4-a*.1+P(1-B*B,-h*6)*.15-a*b*.4+C(a+b)/5+P(C((o*(a+1)+(B&amp;gt;0%3Fw:-w))/25),30)*.1*(1-B*B),o/1e3+.7-o*w*3e-6]}if(c&amp;gt;32){c=c*1.16-.15;o=a*45-20;w=b*b*h;z=o*S(c)+w*C(c)+620;return[o*C(c)-w*S(c),28+C(B*.5)*99-b*b*b*60-z/2-h,z,(b*b*.3+P((1-(A*A)),7)*.15+.3)*b,b*.7]}o=A*(2-b)*(80-c*2);w=99-C(A)*120-C(b)*(-h-c*4.9)+C(P(1-b,7))*50+c*2;z=o*S(c)+w*C(c)+700;return[o*C(c)-w*S(c),B*99-C(P(b, 7))*50-c/3-z/1.35+450,z,(1-b/1.2)*.9+a*.1, P((1-b),20)/4+.05]}}setInterval(\'for(i=0;i&amp;lt;1e4;i++)if(s=p(R(),R(),i%2546/.74)){z=s[2];x=~~(s[0]*f/z-h);y=~~(s[1]*f/z-h);if(!m[q=y*f+x]|m[q]&amp;gt;z)m[q]=z,a.fillStyle=&amp;quot;rgb(&amp;quot;+~(s[3]*h)+&amp;quot;,&amp;quot;+~(s[4]*h)+&amp;quot;,&amp;quot;+~(s[3]*s[3]*-80)+&amp;quot;)&amp;quot;,a.fillRect(x,y,1,1)}\',0)&lt;/textarea&gt;\n\t\t\t&lt;/div&gt;\n\t\t&lt;/div&gt;\n\t&lt;div class=&quot;block-outer&quot;&gt;\n\t\t&lt;b&gt;Description:&lt;/b&gt;\n\t\t&lt;div class=&quot;block-inner&quot;&gt;\n\t\t\t&lt;textarea&gt;Dedicated with all my love to my colleage and friend Antonio Afonso D.S.M.\r\n\r\nOn a technical side, it does Montecarlo sampling of explicit surfaces. It is not fully size optimized (not as much as other of my previous js1k entries), but I don\'t have much more time and I see it finished now.&lt;/textarea&gt;\n\t\t&lt;/div&gt;\n\t&lt;/div&gt;\n\n\n\t\t&lt;script&gt;\n\t\t\tvar collapsed = true;\n\t\t\tfunction toggle() {\n\t\t\t\tvar fs = top.document.getElementsByTagName(\'frameset\')[0];\n\t\t\t\tvar f = fs.getElementsByTagName(\'frame\');\n\t\t\t\tif (collapsed) {\n\t\t\t\t\tfs.rows = \'250px,*\';\n\t\t\t\t\t// enable resizing of frames in firefox/opera\n\t\t\t\t\tfs.noResize = false;\n\t\t\t\t\tf[0].noResize = false;\n\t\t\t\t\tf[1].noResize = false;\n\t\t\t\t} else {\n\t\t\t\t\tfs.rows = \'30px,*\';\n\t\t\t\t\t// disable resizing of frames in firefox/opera\n\t\t\t\t\tfs.noResize = true;\n\t\t\t\t\tf[0].noResize = true;\n\t\t\t\t\tf[1].noResize = true;\n\t\t\t\t}\n\t\t\t\tcollapsed = !collapsed;\n\t\t\t}\n\t\t&lt;/script&gt;\n\t&lt;/body&gt;\n&lt;/html&gt;\n'" />
  <frame marginwidth="0" marginheight="0" frameborder="0" noresize="no" src="javascript:'&lt;!doctype html&gt;\n&lt;html&gt;\n\t&lt;head&gt;\n\t\t&lt;title&gt;JS1k, 1k demo submission [1022]&lt;/title&gt;\n\t\t&lt;meta charset=&quot;utf-8&quot; /&gt;\n\t&lt;/head&gt;\n\t&lt;body&gt;\n\t\t&lt;canvas id=&quot;c&quot;&gt;&lt;/canvas&gt;\n\t\t&lt;script&gt;\n\t\t\tvar b = document.body;\n\t\t\tvar c = document.getElementsByTagName(\'canvas\')[0];\n\t\t\tvar a = c.getContext(\'2d\');\n\t\t\tdocument.body.clientWidth; // fix bug in webkit:http://qfox.nl/weblog/218\n\t\t&lt;/script&gt;\n\t\t&lt;script&gt;\n// start of submission //\nwith(m=Math)C=cos,S=sin,P=pow,R=random;c.width=c.height=f=500;h=-250;function p(a,b,c){if(c&gt;60)return[S(a*7)*(13+5/(.2+P(b*4,4)))-S(b)*50,b*f+50,625+C(a*7)*(13+5/(.2+P(b*4,4)))+b*400,a*1-b/2,a];A=a*2-1;B=b*2-1;if(A*A+B*B&lt;1){if(c&gt;37){n=(j=c&amp;1)%3F6:4;o=.5/(a+.01)+C(b*125)*3-a*300;w=b*h;return[o*C(n)+w*S(n)+j*610-390,o*S(n)-w*C(n)+550-j*350,1180+C(B+A)*99-j*300,.4-a*.1+P(1-B*B,-h*6)*.15-a*b*.4+C(a+b)/5+P(C((o*(a+1)+(B&gt;0%3Fw:-w))/25),30)*.1*(1-B*B),o/1e3+.7-o*w*3e-6]}if(c&gt;32){c=c*1.16-.15;o=a*45-20;w=b*b*h;z=o*S(c)+w*C(c)+620;return[o*C(c)-w*S(c),28+C(B*.5)*99-b*b*b*60-z/2-h,z,(b*b*.3+P((1-(A*A)),7)*.15+.3)*b,b*.7]}o=A*(2-b)*(80-c*2);w=99-C(A)*120-C(b)*(-h-c*4.9)+C(P(1-b,7))*50+c*2;z=o*S(c)+w*C(c)+700;return[o*C(c)-w*S(c),B*99-C(P(b, 7))*50-c/3-z/1.35+450,z,(1-b/1.2)*.9+a*.1, P((1-b),20)/4+.05]}}setInterval(\'for(i=0;i&lt;1e4;i++)if(s=p(R(),R(),i%2546/.74)){z=s[2];x=~~(s[0]*f/z-h);y=~~(s[1]*f/z-h);if(!m[q=y*f+x]|m[q]&gt;z)m[q]=z,a.fillStyle=&quot;rgb(&quot;+~(s[3]*h)+&quot;,&quot;+~(s[4]*h)+&quot;,&quot;+~(s[3]*s[3]*-80)+&quot;)&quot;,a.fillRect(x,y,1,1)}\',0)\n// end of submission //\n\t\t&lt;/script&gt;\n\t&lt;/body&gt;\n&lt;/html&gt;'" />
 </frameset>
</html>

原创粉丝点击