首页 > 其他 > 详细

黑客帝国代码雨

时间:2015-06-11 22:34:26      阅读:450      评论:0      收藏:0      [点我收藏+]

技术分享

codeRain.html

 1 <html>
 2 <head>
 3 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
 4 <title>The world is a matrix</title>
 5 <style type="text/css">
 6 body
 7 {
 8 background-color:#000000;
 9 overflow:hidden;
10 margin:0;
11 }
12 </style>
13 </head>
14 <body>
15 <canvas id="q"></canvas>
16 <script>
17 var s = window.screen;
18 var width = q.width = s.width;
19 var height = q.height = s.height;
20 var letters = Array(256).join(1).split(‘‘);
21 var draw = function () {
22 q.getContext(2d).fillStyle=rgba(0,0,0,0.05);
23 q.getContext(2d).fillRect(0,0,width,height);
24 q.getContext(2d).fillStyle=#00FF00;
25 letters.map(function(y_pos, index){
26 text = String.fromCharCode(34+Math.random()*33);
27 x_pos = index * 10;
28 q.getContext(2d).fillText(text, x_pos, y_pos);
29 letters[index] = (y_pos > 758 + Math.random() * 1e4) ? 0 : y_pos + 10;
30 q.getContext(2d).fillStyle=#00FF00;
31 });
32 };
33 setInterval(draw, 33);
34 </script>
35 </body>
36 </html>

 

黑客帝国代码雨

原文:http://www.cnblogs.com/cangqiongbingchen/p/4570316.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!