Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4.  
  5.  
  6.  
  7. *{
  8. margin: 0;
  9. padding: 0;
  10. }
  11.  
  12. body {background: black;}
  13. canvas {display:block;}
  14.  
  15. </style>
  16. </head>
  17. <body>
  18.  
  19. <canvas id="c"></canvas>
  20.  
  21. <script>
  22.  
  23. var c = document.getElementById("c");
  24. var ctx = c.getContext("2d");
  25.  
  26.  
  27. c.height = window.innerHeight;
  28. c.width = window.innerWidth;
  29.  
  30. var matrix = "ABCDEFGHIJKLMNOPQRSTUVWXYZ123456789@#$%^&*()*&^%";
  31.  
  32. matrix = matrix.split("");
  33.  
  34. var font_size = 10;
  35. var columns = c.width/font_size;
  36.  
  37. var drops = [];
  38. for(var x = 0; x < columns; x++)
  39. drops[x] = 1;
  40.  
  41.  
  42. function draw()
  43. {
  44.  
  45. ctx.fillStyle = "rgba(0, 0, 0, 0.04)";
  46. ctx.fillRect(0, 0, c.width, c.height);
  47.  
  48. ctx.fillStyle = "#0F0";
  49. ctx.font = font_size + "px arial";
  50.  
  51. for(var i = 0; i < drops.length; i++)
  52. {
  53.  
  54. var text = matrix[Math.floor(Math.random()*matrix.length)];
  55.  
  56. ctx.fillText(text, i*font_size, drops[i]*font_size);
  57.  
  58.  
  59. if(drops[i]*font_size > c.height && Math.random() > 0.975)
  60. drops[i] = 0;
  61.  
  62.  
  63. drops[i]++;
  64. }
  65. }
  66.  
  67. setInterval(draw, 35);
  68.  
  69.  
  70. </script>
  71. </body>
  72. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement