Advertisement
Guest User

Untitled

a guest
Jul 27th, 2018
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <html>
  2. <head>
  3. <style>
  4.  
  5. /*basic reset */
  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. // geting canvas by id c
  23. var c = document.getElementById("c");
  24. var ctx = c.getContext("2d");
  25.  
  26. //making the canvas full screen
  27. c.height = window.innerHeight;
  28. c.width = window.innerWidth;
  29.  
  30. var matrix = "`1234567890-=!@#$%^&*()_+qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOPASDFGHJKLZXCVBNM<>?;'\"\\|~";
  31. matrix = matrix.split("");
  32.  
  33. var font_size = 10;
  34. var columns = c.width/font_size;
  35. var drops = [];
  36. for(var x = 0; x < columns; x++)
  37. drops[x] = 1;
  38. function draw()
  39. {
  40. ctx.fillStyle = "rgba(0, 0, 0, 0.04)";
  41. ctx.fillRect(0, 0, c.width, c.height);
  42.  
  43. ctx.fillStyle = "#FF8000";
  44. ctx.font = font_size + "px arial";
  45. for(var i = 0; i < drops.length; i++)
  46. {
  47. var text = matrix[Math.floor(Math.random()*matrix.length)];
  48. ctx.fillText(text, i*font_size, drops[i]*font_size);
  49. if(drops[i]*font_size > c.height && Math.random() > 0.975)
  50. drops[i] = 0;
  51. drops[i]++;
  52. }
  53. }
  54.  
  55. setInterval(draw, 35);
  56.  
  57.  
  58. </script>
  59. </body>
  60. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement